Window下開發環境安裝和Hello World

2021-06-29 06:35:12 字數 2214 閱讀 5823

objective-c是在c語言的基礎上的擴充套件,是一種物件導向的程式語言。這裡假設讀者有物件導向的程式設計基礎。

package

required?

stable

unstable

notes

gnustep msys system

required

0.28.1

-msys/mingw system

gnustep core

required

0.28.0

-gnustep core

gnustep devel

optional

1.3.0

-developer tools

cairo backend

optional

0.22.1

none

don't use. developer only

並依次進行安裝,安裝路徑最好是在根目錄下沒有中文以及空格的資料夾中,我的安裝路徑是d:\gnustep

安裝後的資料夾結構為:

[plain]view plain

copy

d:\gnustep 的目錄  

dir>         .  

..  

bin  

doc  

gnustep  

48 gnustep msys windows system.url  

3,899 gnustep-core-readme.rtf  

3,294 gnustep-devel-readme.rtf  

5,101 gnustep-system-readme.rtf  

include  

lib  

libexec  

man  

mingw  

mingw32  

msys  

share  

53,198 uninstallgnustepcairo.exe  

81,344 uninstallgnustepcore.exe  

68,162 uninstallgnustepdevel.exe  

4,329 uninstallgnustepsystem.exe  

var  

2. 啟動shell

開啟開始->程式->gnustep->shell,shell介面如下:

啟動時的路徑是位於d:\gnustep\msys\1.0\home\60377,其中60377為使用者名稱,為了方便起見,我們後邊直接將程式放到這個資料夾下,這裡我們稱之為home。

3. hello world程式

在home中建立乙個檔名為main.m的檔案,其中m為副檔名,內容如下:

[cpp]view plain

copy

#import 

intmain(

intarvc, 

char

* argv)    

然後在shell中輸入:

[plain]view plain

copy

gcc -o main main.m -i/gnustep/system/library/headers/ -fconstant-string-class=nsconstantstring -l/gnustep/system/library/libraries -lobjc -lgnustep-base  

然後可以通過ls命令檢視是否生成了mian.exe檔案,如果生成了,則在shell中輸入main.exe來檢視執行結果,如下圖所示:

由於gcc命令太長,可以採用makefile,具體如下:

在home中建立乙個名為makefile的檔案,沒有副檔名,內容如下:

[plain]view plain

copy

gen:  

gcc -o main main.m -i/gnustep/system/library/headers/ -fconstant-string-class=nsconstantstring -l/gnustep/system/library/libraries -lobjc -lgnustep-base  

注意:gcc前邊是乙個tab。

然後在shell中執行make命令,會自動生成main.exe,如下圖:

Window下開發環境安裝和Hello World

ios培訓 我的c語言筆記,期待與您交流 在ios開發中,objective c是在c語言的基礎上的擴充套件,是一種物件導向的程式語言。並依次進行安裝,安裝路徑最好是在根目錄下沒有中文以及空格的資料夾中,我的安裝路徑是d gnustep 2.啟動shell 開啟開始 程式 gnustep shell...

Window下MongoDB的環境安裝和初始化

mongod.exe 是用來連線到mongo資料庫伺服器的,即伺服器端。mongo.exe 是用來啟動mongodb shell的,即客戶端。其他檔案 mongodump 邏輯備份工具。mongorestore 邏輯恢復工具。mongoexport 資料匯出工具。mongoimport 資料匯入工具...

window環境下安裝easy install

選擇zip包 2.解壓包 3.命令列工具cd切換到setuptool的目錄例如c users admin downloads setuptools 20.3 然後輸入python setup.py install 稍等片刻後即安裝成功 6.把python的指令碼路徑新增到環境變數path中,例如c ...