Learning Objective-C on Windows with GNUstep and Eclipse

Writing iOS or Cocoa apps does require a Mac with XCode, but you can learn Objective-C (and work on libraries and command-line apps) on Microsoft Windows.

GCC includes an Objective-C compiler. You can install GCC on Windows via Cygwin or MinGW.

You can also get the GNUStep implementation of the OpenStep libraries which includes the same core libraries as Cocoa — including Foundation which contains NSString, etc.

GNUstep includes a graphical environment GWorkspace which is a clone of the NeXT workspace manager. I haven’t gotten GWorkspace (or Backbone and alternative) to work on Windows or any other graphical apps, but you can use graphical GNUstep apps on Linux.

What this means is that the core libraries and command line apps can work on Windows — which is good for learning basic Objective-C concepts.

In order to use GNUstep on Windows install the GNUstep MSYS System — which gives you the core unix-like tools you know and love.

Next install GNUStep Core. You should be able to open a Shell window and execute commands.

Then install GNUStep Devel which will give you GCC with Objective-C and the GNUStep libraries which allow development.

Gorm is an interface builder for GNUStep which allows you to create (admittedly ugly) GNUstep user interfaces via drag and drop — but I couldn’t get it to work on Windows.

Once you have MSYS, GNUStep Core, and GNUStep Devel, launch the shell from your Windows Start menu.

gnustep start menu

Using a text editor, write a hello world app:

#import <Foundation/Foundation.h>

int main(int argc, const char *argv[]) 
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
	NSLog (@"Objective-C with GNUstep on Windows");
	return 0;

Voila, you’re coding in Objective-C on Windows with GCC!

You can see that your managing memory the old fashioned way. You don’t have ARC, but you can get modern features using clang which is the compiler used by XCode.

Directions for installing clang on Windows are available here:



1. Checkout LLVM
2. Checkout clang into the llvm/tools folder
3. Edit llvm/tools/clang/lib/Frontend/InitHeaderSearch.cpp

Look for // FIXME: temporary hack: hard-coded paths. (on line 223 currently)

// FIXME: temporary hack: hard-coded paths.
AddPath("C:\\GNUstep\\include", System, true, false, false);
AddPath("C:\\GNUstep\\msys\\1.0\include", System, true, false, false);
AddPath("C:\\GNUstep\\lib\\gcc\\mingw32\\4.6.1\\include", System, true, false, false);
AddPath("C:\\GNUstep\\lib\\gcc\\mingw32\\4.6.1\\include\\c++", System, true, false, false);
AddPath("C:\\GNUstep\\GNUstep\\System\\Library\\Headers", System, true, false, false);
//AddPath("/usr/local/include", System, true, false, false);

4. Compile

cd llvm && mkdir build && cd build
../configure --enable-optimized --enable-targets=host-only
make && make install

An error is expected and not a problem groff: command not found

Now you can use ARC in your Objective-C on GNUstep compiled with clang:

// test.m

#include <Foundation/Foundation.h>

int main(){
        NSLog( @"Objective-C with ARC on Windows");
    return 0;

Here’s a sample GNUmakefile:

include $(GNUSTEP_MAKEFILES)/common.make

TOOL_NAME = test
test_OBJC_FILES = test.m

include $(GNUSTEP_MAKEFILES)/tool.make

Now run:

make CC=clang

Now, using a plain text editor (even Sublime Text) for writing code isn’t always fun..But you can use Eclipse.

Install the Eclipse CDT (C/C++ Development tools) and follow the directions here to set up Eclipse for using Objective-C:


I haven’t yet gotten Objective-C to compile with Eclipse CD% yet but I’ll post more when I’ve got it working.

6 thoughts on “Learning Objective-C on Windows with GNUstep and Eclipse

  1. n1 anotherway is to install cygwin it should work as well. Because u have a complete unix system on windows as the host system. its n1 just try it. :)

  2. “I haven’t yet gotten Objective-C to compile with Eclipse CDT yet but I’ll post more when I’ve got it working.”
    Can you provide more details about EclipseCDT(CDT 8.2.0 for Eclipse Kepler)+Gnustep and odj-c examples on it…. and does it really works..??

  3. Henrik (sorry to give you my private, non-offical mail, but, unfortunately, nowadays the net requires some self-effacement) says:

    Hi there,
    I m occupied to teach ObjC & iOS in an advanced Germany so I need an environment preferably indipendent of an Apple plattform as possible.

    Following your instructions I just have to say how lucky is everybody getting this help. Never loaded and installed a plattform or what so ever else in such an easy way – so make many other users a favore and leave this online unlimitted! (beyond that the net will never forget anyway ;-) )

    And if you will make it to install other mentioned components plaese publish and let me know.


  4. Hi, Aaron, i ve done everything you mentioned above but i encountered a difficulty when i was trying to run a code on clang.

    When i type make CC=clang it gives me the follwoing:

    Compiling file test.m…
    clang.exe: error: unknown argument: ‘-fexec-charset=UTF-8’

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s