objective-c – 如何在Linux上编译objc代码?

前端之家收集整理的这篇文章主要介绍了objective-c – 如何在Linux上编译objc代码?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
假设您在 Linux服务器上准备好了.h和.m,那么您会向GCC发出哪个命令来编译它?

解决方法

相关部分:
gcc -c -Wno-import List.m

gcc -o prog -Wno-import List.o main.o -lobjc

. . . make sure that the Objective-C library and header files (objc/Object.h) were installed when gcc was built.

Note that when linking Objective-C with gcc,you need to specify the Objective-C library by using the -lobjc switch.

有关更多信息,请参见此link.

附加link可能解决丢失的编译器问题:

Try installing either gobjc++ or gobjc

sudo apt-get install gobjc++

猜你在找的C&C++相关文章