GNUstep的安装

来源:互联网 发布:linux机器重启命令 编辑:程序博客网 时间:2024/05/18 03:18

由于暂时还没有Mac的本本,只能现在Linux上练习Objective-C的语法了,安装的过程并不顺利,这里采用的平台依旧是Debian, Windows也是可以的,

 

关于GNUstep就不多说了,自己去官网看吧,总之就是一个跨平台的Objective-C的编译运行环境,下面开始安装:

 

#apt-get install gnustep

#apt-get install gnustep-devel

#apt-get install libgnustep-base-dev

#apt-get install gnustep-games

 

这样就安装完毕了,(上面的安装包可以放在一起,一次安装完的,不要小看了那几个包,shitou可是花了很大功夫才找到的,为了表示寻找的痛苦,还是写长点吧,^_^)

 

然后就是配置了,Firstly:

#echo 'export LIBRARY_PATH=/usr/lib/GNUstep/System/Library/Libraries' >> ~/.profile

#echo 'export OBJC_INCLUDE_PATH=/usr/include/GNUstep/Headers' >> ~/.profile

#source ~/.profile

 

然后执行GNUstep.sh的脚本,自动加载其他环境PATH:

#chmod +x /usr/share/GNUstep/Makefiles/GNUstep.sh

#source /usr/share/GNUstep/Makefiles/GNUstep.sh

 

也加入.profile文件, 以便用户登陆系统时加载

#echo 'source /usr/share/GNUstep/Makefiles/GNUstep.sh' >> ~/.profile

 

这样就设置完毕了,然后就是写个ObjC的程序测试下了,在测试时可能会报的错是NXConstantString之类的错误, 办法就是:

 

#gcc -o hello hello.m -fconstant-string-class=NSConstantString -lobjc -lgnustep-base

 

这样就大功告成了, 好了,下面开始正式学习Objective-C...........