随笔-193  评论-715  文章-1  trackbacks-0
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看看效果吧。
posted on 2011-07-24 16:39 Robin's Programming World 阅读(2185) 评论(2)  编辑  收藏

评论:
# re: Windows Objective C编译环境搭建 2013-01-21 11:21 | g
C:\GNUstep\bin>gcc.exe 改成 C:\GNUstep\bin\gcc.exe  回复  更多评论
  
# re: Windows Objective C编译环境搭建 2013-04-06 14:09 |
感谢楼主分享,  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: