Objective C for Windows
You can use Objective C inside the Windows environment. If you follow these steps, it should be working just fine:
- Visit the GNUstep website and download
GNUstep MSYS Subsystem(MSYS for GNUstep),GNUstep Core(Libraries for GNUstep), andGNUstep Devel - After downloading these files, install in that order, or you will have problems with configuration
- Navigate to
C:\GNUstep\GNUstep\System\Library\Headers\Foundation1 and ensure thatFoundation.hexists - Open up a command prompt and run
gcc -vto check thatGNUstep MSYSis correctly installed (if you get a file not found error, ensure that thebinfolder ofGNUstep MSYSis in yourPATH) -
Use this simple "Hello World" program to test GNUstep's functionality:
#import <Foundation/Foundation.h> int main(int argc, char**argv) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog(@"headfile dir is ok\n"); [pool release]; return 0; }
-
Go back to the command prompt and
cdto where you saved the "Hello World" program and then compile it:2gcc -o helloworld.exe <HELLOWORLD>.m -I /GNUstep/GNUstep/System/Library/Headers-L /GNUstep/GNUstep/System/Library/Libraries-std=c99 -lobjc -lgnustep-base -fconstant-string-class=NSConstantString -
Finally, from the command prompt, type
helloworldto run it
All the best, and have fun with Objective-C!

浙公网安备 33010602011771号