Andreas Walsh

logo

How to set up an Objective-C Environment on Windows.


1. Go to the GNUstep site: http://www.gnustep.org/experience/Windows.html

These are the files you need -
GNUstep MSYS System
GNUstep Core
GNUstep Devel

2. After you download all these files, install them in order.
FIRST install
GNUstep MSYS System
then,
GNUstep Core
finaly,
GNUstep Devel
[Here I used only the default installation paths]

Go to C:\GNUstep\GNUstep\System\Library\Headers\Foundation and make sure that foundation.h file is there.

3. Bring up a command prompt and type gcc -v to check that GNUstep is correctly installed.

4. Then create a simple helloworld program to test, giving it an ".m" extension for Objective-C.

     #include  <Foundation/Foundation.h>
     int main(void)
     {
         NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

         NSLog(@"Hello World!.");

         [pool drain];
         return;
    }

5. To compile this file, at the command prompt change directory to the folder where you have saved the file.
Type the following command to compile the program:

gcc -o helloworld helloworld.m -I /GNUstep/GNUstep/System/Library/Headers
-L /GNUstep/GNUstep/System/Library/Libraries -std=c99 -lobjc -lgnustep-base -fconstant-string-class=NSConstantString


Make sure the folder structure of the path is your GNUstep installation path otherwise it will throw an error.
If you have another gcc (GNU compiler) installed on your computer (like for QT), you may need to specify the location of the compiler exactly.
e.g. c:\GNUstep\bin\gcc -o helloworld...

6. Then type helloworld and Enter to run the generated helloworld.exe file.

If your environment variables have been set for a previous gcc installation, they may have to be adjusted as well.

With this basic setup you can follow a book like Objective-C Programming by Aaron Hillegass.

(Thanks to: teshguru at iesrilanka.org for this information.)

Next: XCode and InterfaceBuilder on Windows