Windows Objective C编译环境搭建

Windows中也可以有Objective C的编译环境,这对于一个想学习这门语言的人来说,基本上已经足够了,下面来看看如何搭建吧。
1,安装GNUSetup环境:
http://www.gnustep.org/experience/Windows.html
进入此网站,下载上面提供的4个安装包,依次安装。

2,写一段测试代码,如下,保存到 c:\hello.m
#import <Foundation/Foundation.h>

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

return 0;
}


3,编译,执行如下命令:

C:\GNUstep\bin>gcc.exe c:\hello.m -o c:\hello.exe -I c:\GNUstep\GNUstep\System\Library\Headers -L c:\GNUstep\GNUstep\System\Library\Libraries -lobjc -fobjc-exceptions -lgnustep-base -fconstant-string-class=NSConstantString -enable-auto-import


4, 大功告成,运行c:\hello.exe看看效果吧。

原文地址:https://www.cnblogs.com/xgbzsc/p/ios.html