Windows中也可以有Objective C的編譯環境,這對于一個想學習這門語言的人來說,基本上已經足夠了,下面來看看如何搭建吧。
1,安裝GNUSetup環境:
1,安裝GNUSetup環境:
http://www.gnustep.org/experience/Windows.html
進入此網站,下載上面提供的4個安裝包,依次安裝。
2,寫一段測試代碼,如下,保存到 c:\hello.m
進入此網站,下載上面提供的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;
}
int main (int argc, const char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog(@"Hello World!");
[pool drain];
return 0;
}
3,編譯,執行如下命令:


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