Assuming you have your .h and .m ready on a Linux server, which command would you issue to GCC to have it compiled?
Asked
Active
Viewed 4,557 times
7
James Raitsev
- 87,465
- 141
- 322
- 462
-
1Just a heads up: you cannot compile code that uses Apple's Cocoa classes. I recommend reading this post: [Starting iPhone app development in Linux?](http://stackoverflow.com/questions/276907/starting-iphone-app-development-in-linux) – Jeremy Dec 21 '11 at 17:21
2 Answers
9
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++
N_A
- 19,627
- 4
- 49
- 97
4
gcc -x objective-c file.m -o out
Google is your friend
Manlio
- 10,538
- 9
- 47
- 77
-
Comes back with `gcc: error trying to exec 'cc1obj': execvp: No such file or directory` Is there some setup that needs to happen prior to this? – James Raitsev Dec 21 '11 at 17:17
-
1