ubuntu下编译objective-c:
1、安装编译环境
sudo aptitude install build-essential gobjc gobjc++ gnustep gnustep-devel libgnustep-base-dev -y
2、编写makefile
pp:$(s)
gcc `gnustep-config --objc-flags` $(s) -o app -lgnustep-base -lobjc
clean:
rm *.d
rm app
3、编写测试oc代码
#import <Foundation/Foundation.h>
int main(int argc, const char* argv[])
{
NSLog(@"Hello world!");
return 0;
}
4、编译
$ make s=main.m
gcc `gnustep-config --objc-flags` main.m -o app -lgnustep-base -lobjc
5、运行
$ ./app
2016-10-16 9:50:31.137 app[17597] Hello world!
6、清除编译和目标文件
make clean