Cannot find Foundation / NSObject.h on Linux while building Obj-c Program

I just started learning obj-c on Ubuntu Linux today, the tutorial that I followed, http://www.otierney.net/objective-c.html , when I entered the code that is required for Foundation / NSObject.h, an error appeared :

Fraction.h: 1: fatal error: Foundation / NSObject.h: no such file or directory

and I searched for solutions and found a suitable gcc -o Fraction -I/usr/GNUstep/System/Library/Headers -L/usr/GNUstep/System/Library/Libraries Fraction.m -ldl -lobjc

I tried this, but found that I could not find the headers in the library directory. (My GNUstep folder is / usr / share / GNUstep).

Does anyone know how to reach the headlines? I installed all the dev packages related to GNUstep, but still no luck.

I hope that I will formulate my question quite clearly. Sorry for my English.

+4
source share
4 answers

Try with gnustep-config

 gcc `gnustep-config --objc-flags` \ `gnustep-config --objc-libs` Fraction.m -o Fraction 
+1
source

GNUStep uses a fairly involved set of gmake macros - I would not expect a simple gcc command line command to work very well, although to be honest, I have not tried it myself. I found the Nicolo Pera tutorial and my own page is very useful when learning how to write make files for use with GNUStep.

0
source

In my case, I installed gnustep-base to fix this error:

 yum install gnustep-base 
0
source

In my case, compiling SOPE on CentOS 7 is installed

 yum install gnustep-base-devel 

This solved the problem.

0
source

All Articles