Ubuntu下Object-C 的开发环境搭建

  • 1、软件安装:
sudo apt-get install build-essential gnustep gobjc gnustep-make libgnustep-base-dev gnustep-devel
  • 2、测试:
#import <stdio.h>;
int main( int argc, const char * argv[] ) {
printf("hello world\n");
return 0;
}
  • 然后执行编译:
gcc hello.m -o hello
  • 如果调用到了 object-c的库, 以上编译命令会出错, 需要用下面命令:
gcc `gnustep-config --objc-flags` -lgnustep-base hello.m -o hello
  • 然后执行代码看看
./hello
/**
输出结果:
hello world
*/

标签: linux