How to compile objc code in Linux?

Assuming you have ready-made .h and .m on a Linux server, which command could you pass to GCC to compile?

+6
source share
2 answers

Relevant Parts:

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

., make sure that the libraries and Objective-C header files (objc / Object.h) were installed when creating gcc.

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

See the link for more details.

Additional link with a possible solution to the problem with the missing compiler:

Try installing gobjc ++ or gobjc

 sudo apt-get install gobjc++ 
+8
source
 gcc -x objective-c file.m -o out 

Google is your friend

+3
source

Source: https://habr.com/ru/post/904261/


All Articles