linux下编译objectc

编译静态库给ios使用http://www.tuicool.com/articles/UZr6z2

1.$yum-yinstallgcc-objc

2.从http://wwwmain.gnustep.org下载GNUstepStartup和GNUstepBase,并从源码进行安装。

3..$exportPATH=$PATH:/usr/GNUstep/System/Tools

4.$echo"/usr/GNUstep/Local/Library/Libraries/">>/etc/ld.so.conf

$ldconfig

5.$gcc`gnustep-config--objc-flags`-L/usr/GNUstep/Local/Library/Libraries-lgnustep-basehello.m-ohello

6.runprogram

prepare:

#yuminstallgcc-objc

#yuminstalllibpnglibpng-devellibtifflibtiff-devellibobjclibxml2libxml2-devellibX11-devellibXt-devellibjpeglibjpeg-devel

#wgetftp://ftp.gnustep.org/pub/gnustep/core/gnustep-startup-0.25.0.tar.gz

#tarzxvfgnustep-startup-0.25.0.tar.gz

#cdgnustep-startup-0.25.0

#./configure

#make

#vi~/.bashrc加入一行:

/usr/GNUstep/System/Library/Makefiles/GNUstep.sh

把/usr/GNUstep/Local/Library/Libraries/加到系统的lib路径里面

#vi/etc/ld.so.conf加入下面一行:

/usr/GNUstep/Local/Library/Libraries/

编译环境配置好,写一个test.m并用下面的命令编译:

#gcc`gnustep-config--objc-flags`-L/usr/GNUstep/Local/Library/Libraries-lgnustep-basetest.m-otest

#./test

正常的话会正确执行,如果有报“Unknowntimezonename`CST'.”,请修改/etc/localtime设置正确的系统时区

#vi/etc/localtime清空之前的内容,加入下面的:

TZif2

UTC-8

http://blog.sina.com.cn/s/blog_5326096f0101c3m8.html

相关推荐