James Raitsev
James Raitsev

Reputation: 96541

How to compile objc code on Linux?

Assuming you have your .h and .m ready on a Linux server, which command would you issue to GCC to have it compiled?

Upvotes: 7

Views: 4782

Answers (2)

N_A
N_A

Reputation: 19897

The relevant parts:

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.

See this link for more information.

Additional link with possible solution to the missing compiler issue:

Try installing either gobjc++ or gobjc

sudo apt-get install gobjc++

Upvotes: 9

Manlio
Manlio

Reputation: 10864

gcc -x objective-c file.m -o out

Google is your friend

Upvotes: 4

Related Questions