Windows平臺下Objective-C模擬開發(fā)環(huán)境搭建
Windows平臺下Objective-C模擬開發(fā)環(huán)境搭建 是本文要介紹的內(nèi)容,主要是來學習如何在Windows平臺下實現(xiàn)Objective-C 模擬開發(fā)環(huán)境搭建,包括安裝 GNUstep 、編寫 Hello, World! 、Objective-C程序編譯、gcc 快捷方式等。Objective-C Windows,Objective-C 模擬開發(fā)環(huán)境,Objective-C 開發(fā)環(huán)境下載,Objective-C 開發(fā)環(huán)境安裝。
1、安裝 GNUstep
GNUstep 官方網(wǎng)站
GNUstep Windows Installer 提供了 Windows 平臺下的 Objective-C 的模擬開發(fā)環(huán)境,一共有四個軟件包,其中GNUstep System 和 GNUstep Core 必裝,GNUstep Devel和Cairo Backend 選裝。
2、編寫 Hello, World!
安裝完成后,在開始菜單里的GNUstep選項里執(zhí)行shell,就能打開命令行,在這里就可以使用vi編寫Objective-C程序了,不過操作起來總有些繁瑣,其實也可以直接在Windows平臺里進入C:\GNUstep\home\username目錄,在這里用你喜歡的工具編寫Objective-C程序,然后再進入shell里編譯。
直接給出 helloworld.m 文件內(nèi)容,取自 Programming in Objective-C 2.0一書:
以下為引用內(nèi)容:
- #import <Foundation/Foundation.h>
- int main (int argc, const char *argv[]) {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSLog(@"Hello World!");
- [pool drain];return 0;
- }
3、程序編譯
***次編譯:
以下為引用內(nèi)容:gcc -o helloworld helloworld.m結(jié)果出現(xiàn)錯誤信息,找不到頭文件:
以下為引用內(nèi)容:
- helloworld.m:1:34: Foundation/Foundation.h: No such file or directory
- helloworld.m: In function `main':
- helloworld.m:4: error: `NSAutoreleasePool' undeclared (first use in this function)
- helloworld.m:4: error: (Each undeclared identifier is reported only once
- helloworld.m:4: error: for each function it appears in.)
- helloworld.m:4: error: `pool' undeclared (first use in this function)
- helloworld.m:5: error: cannot find interface declaration for `NXConstantString'
小結(jié):Windows平臺下Objective-C模擬開發(fā)環(huán)境搭建的內(nèi)容介紹完了,希望通過本文的學習能對你有所幫助!