Windows平台下Objective-C類比開發環境搭建

來源:互聯網
上載者:User

Windows平台Objective-C類比開發環境搭建  是本文要介紹的內容,主要是來學習如何在Windows平台下實現Objective-C 類比開發環境搭建,包括安裝 GNUstep 、編寫 Hello, World! 、Objective-C程式編譯、gcc 捷徑等。Objective-C Windows,Objective-C 類比開發環境,Objective-C 開發環境下載,Objective-C 開發環境安裝。

1、安裝 GNUstep

GNUstep 官方網站

GNUstep Windows Installer 提供了 Windows 平台下的 Objective-C 的類比開發環境,一共有四個軟體包,其中GNUstep System 和 GNUstep Core 必裝,GNUstep Devel和Cairo Backend 選裝。

2、編寫 Hello, World!

安裝完成後,在開始菜單裡的GNUstep選項裡執行shell,就能開啟命令列,在這裡就可以使用vi編寫Objective-C程式了,不過操作起來總有些繁瑣,其實也可以直接在Windows平台裡進入C:\GNUstep\home\username目錄,在這裡用你喜歡的工具編寫Objective-C程式,然後再進入shell裡編譯。

直接給出 helloworld.m 檔案內容,取自 Programming in Objective-C 2.0一書:

以下為引用內容:

 
  1. #import <Foundation/Foundation.h> 
  2. int main (int argc, const char *argv[]) {  
  3. NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];  
  4. NSLog(@"Hello World!");  
  5. [pool drain];return 0;  

3、程式編譯

第一次編譯:

以下為引用內容:gcc -o helloworld helloworld.m結果出現錯誤資訊,找不到標頭檔:

以下為引用內容:

 
  1. helloworld.m:1:34: Foundation/Foundation.h: No such file or directory  
  2. helloworld.m: In function `main':  
  3. helloworld.m:4: error: `NSAutoreleasePool' undeclared (first use in this function)  
  4. helloworld.m:4: error: (Each undeclared identifier is reported only once  
  5. helloworld.m:4: error: for each function it appears in.)  
  6. helloworld.m:4: error: `pool' undeclared (first use in this function)  
  7. helloworld.m:5: error: cannot find interface declaration for `NXConstantString'  

小結:Windows平台Objective-C類比開發環境搭建的內容介紹完了,希望通過本文的學習能對你有所協助!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.