Cent OS Objective-C:GCC+GNUstep 配置

http://www.techotopia.com/index.php/Building_and_Installing_GNUstep_on_Linux
http://blog.csdn.net/reddream228/article/details/6588032
上面两篇应该都可以。
我是按照第一篇来的,期间遇到问题如下:

第一个错误:

E127 Error
No X11 libraries/headers were found for compiling GNUstep GUI. You may
have X11 installed, but not the developer packages, which are required
for compiling anything that uses X. If you are using Debian, or a similar
packaged system, try looking for help on installing developer or -dev
packages for the X11 system.

是缺少相应的安装包:

http://pkgs.info/ 一个可以查linux安装包的网站。
yum install libXt-devel

然后其他缺少的:

yum install gnutls-devel
yum install libicu-devel
yum install libjpeg libjpeg-devel

安装成功以后的提示:

Now run the GNUstep initialization script (put this in your
.bashrc or other type of startup script). Note the '.' at the
beginning of the line.
. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh

Now you can install some applications and start using GNUstep
Look for a few applications in the AppSources directory. The
typical way to install an application is:
tar -zxf MyApplication.tar.gz
cd MyApplication
make
make install (as root, unless GNUstep is in your home dir)

Then start the application:
openapp MyApplication.app

但是编译的时候一直不对,折腾了好久才发现第一篇安装说明里的路径错误了。
因该是:

gcc gnustep-config --objc-flags -L/usr/GNUstep/System/Library/Libraries -lgnustep-base hello.m -o hello

也可能是版本不同导致的。
我安装的最新的0.30

下面这个命令也可以编译成功的。

gcc -o helloworld helloworld.m -I/GNUstep/System/Library/Headers -fconstant-string-class=NSConstantString -L/GNUstep/System/Library/Libraries -lobjc -lgnustep-base

之前在windows下一直编译不通过应该也是路径错了。

你可能感兴趣的:(Cent OS Objective-C:GCC+GNUstep 配置)