ubuntu搭建object c環境

2021-06-07 13:43:36 字數 1423 閱讀 3265

環境:ubuntu 10.0.4

ubuntu下object-c的開發環境搭建:

1.安裝gnustep和gobjc

sudo apt-get install gobjc gnustep gnustep-devel

需要公升級一下

2.hello world

#import

int main(int argc, const char *argv)  

3.環境設定

hello.m:1: fatal error: foundation/foundation.h: 沒有那個檔案或目錄

compilation terminated.

4.gcc `gnustep-config --objc-flags` hello.m -o hello

/tmp/ccrmas5f.o: in function `main':

/home/shaochangqing/study/hello.m:3: undefined reference to `objc_get_class'

/home/shaochangqing/study/hello.m:3: undefined reference to `objc_msg_lookup'

/home/shaochangqing/study/hello.m:3: undefined reference to `objc_msg_lookup'

/home/shaochangqing/study/hello.m:4: undefined reference to `nslog'

/home/shaochangqing/study/hello.m:5: undefined reference to `objc_msg_lookup'

/tmp/ccrmas5f.o: in function `__objc_gnu_init':

/home/shaochangqing/study/hello.m:7: undefined reference to `__objc_exec_class'

/tmp/ccrmas5f.o:(.data.rel+0x0): undefined reference to `__objc_class_name_nsautoreleasepool'

/tmp/ccrmas5f.o:(.data.rel+0x8): undefined reference to `__objc_class_name_nsconstantstring'

collect2: ld returned 1 exit status

5.鏈結庫

gcc `gnustep-config --objc-flags` -lgnustep-base hello.m -o hello

注意不是單引號  

6.run it

2012-05-13 13:59:05.650 hello[6374] hello world

Ubuntu下Object C開發環境搭建

gnu編譯器只支援最基本的部分object c,為了ubuntu下使用整個的objective c的cocoa openstep環境,所以必須安裝gcc和gcc和objective c支援的包,gnustep的環境.首先安裝gnustep和gobjc quote sudo apt get insta...

Ubuntu搭建tensorflow gpu版環境

安裝顯示卡驅動 安裝cuda 10.1.2 cuda官網 cuda 10.1 根據官網上的安裝過程安裝 wget sudo mv cuda ubuntu1804.pin etc apt preferences.d cuda repository pin 600 wget sudo dpkg i cu...

ubuntu環境搭建

1 apt 和 apt get的區別 建議使用apt 2 ubuntu下解決埠被占用問題 3 ubuntu 的ufw詳解 防火牆 4 ubuntu16.04安裝redis 5 ubuntu安裝redis後啟動失敗 failed to start advanced key value store 6 ...