Objective-c compilation error

I use Fedora (laughter). I programmed a lot in c and java on this distribution. So I decided to try several Objective-C programs on Linux. I searched many pages over the internet and finally found it.

http://www.techotopia.com/index.php/Building_and_Installing_GNUstep_on_Linux

I went according to the instructions on this page to install GNUstep .

In the installation, everything went well. But after writing a small piece of code and compiling it with the command:

 gcc gnustep-config --objc-flags` -L/usr/GNUstep/System/Library/Libraries -lgnustep-base hello.m -o hello 

This gave me the following error:

/usr/bin/ld: /usr/GNUstep/System/Library/Libraries/libgnustep-base.so: undefined reference to symbol 'objc_msg_lookup' /usr/bin/ld: note: 'objc_msg_lookup' is defined in DSO /usr/lib/libobjc.so.2 so try adding it to the linker command line /usr/lib/libobjc.so.2: could not read symbols: Invalid operation collect2: ld returned 1 exit status

I am new to Objective-C. I do not know where the linker command exists. I tried adding the /usr/lib variable to the env. variable env. . But that did not work. I also tried to find solutions on their forum (if they had one!). But they do not have them.

Can anyone help me with this?

Thanks in advance!

+4
source share
3 answers

He complains that you are referencing code that you do not associate with your application. Useful, it tells you what is missing and where it is. Try adding -lobjc to the flags.

+6
source

in my case, just adding the -lobjc flag to the command line argument, it worked fine.

 gcc `gnustep-config --objc-flags` -Wl,--no-as-needed -lgnustep-base -lobjc firstObjcProg.m -o firstObjcProg 
+4
source

Try the following:

 gcc `gnustep-config --objc-flags` -o hello hello.m -L /GNUstep/System/Library/Libraries -lobjc -lgnustep-base 
0
source

All Articles