Assuming you have your .h
and .m
ready on a Linux server, which command would you issue to GCC
to have it compiled?
The gcc Objective-C support can be installed on Linux simply by installing the gcc-objc package which is available with all Linux distributions. There are, however, two different paths to installing GNUstep.
0 GNU Compiler Collection. This is a GNU package. GCC is the GNU Compiler Collection. It provides compiler front-ends for several languages, including C, C++, Objective-C, Fortran, Java, Ada, and Go.
Objective-C compiles into machine code. Remember that the language (Objective-C, C, C++) only defines the rules to correctly write code. The compiler checks to see if your code is correct and compiles it, i.e., translates it into executable code. Also, don't confuse Objective-C language, and the Objective-C runtime.
gcc -x objective-c file.m -o out
Google is your friend
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++
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With