Objective-C on Windows via GNUStep



$ cat helloworld.m
#import <Foundation/Foundation.h>

int main(int argc, const char* argv[])
{
        NSAutoreleasePool *pool=[[NSAutoreleasePool alloc]init];
        NSLog(@"Hello World!");
        [pool drain];

        return 0;
}
bruce.lin.chn@lion ~
$ gcc -fconstant-string-class=NSConstantString -I /GNUstep/System/Library/Headers/ -c helloworld.m

bruce.lin.chn@lion ~
$ gcc -o helloworld helloworld.o -L /GNUStep/System/Library/Libraries/ -lobjc -
lgnustep-base

bruce.lin.chn@lion ~
$ ./helloworld.exe
2011-07-15 13:05:55.542 helloworld[4336] Hello World!

你可能感兴趣的:(Objective-C)