Windows 下学习 Objective-C 环境准备 Hello world
在等最新版的Mac book pro机子,不知道什么时候会出,只能先在windows下学习最基本的语法。百度 windows Objective-c ,竟然可以在windows下整个Objective c的开发环境!
安装:
GNUstep Windows Installer提供了Windows平台下的Objective-C的模拟开发环境,一共有四个软件包,其中GNUstepSystem和GNUstepCore是必装的,GNUstepDevel和CairoBackend是选装的。甭管必装选装,一次性全安上,免得以后麻烦。4个下载下来后要注意安装的次序!!
安装好 Windows->开始-> GNUstep->Shell
出现下面的界面就说明你成功了。
编写helloworld.m文件,用记事本,Notepad++,UltraEdit都可以,放到C:\GNUstep\home\你的用户名 这个目录下
附上GNUmakefile和helloworld.m文件的下载地址:
第二个方法:
helloworld.m文件放的地方不变还是C:\GNUstep\home\你的用户名 这个目录下
接下来要写一个文件叫 helloworld.sh
#!/bin/shif [ $# -ne 2 ]; thenecho "Usage: $0 source output"exit 1figcc -g -o $2 $1 \-lobjc \-fobjc-exceptions \-lgnustep-base \-I /GNUstep/System/Library/Headers/ \-L /GNUstep/System/Library/Libraries/ \-fconstant-string-class=NSConstantString然后打开shell 输入 ./helloworld.sh helloworld.m helloworld.exe成功后就会生成helloworld.exe文件,在shell里输入 ./helloworld.exe就能得到相同的结果了。
附上helloworld.sh 和helloworld.m文件的下载地址:
helloworld1文章源地址:http://www.waitingfy.com/?p=113