I'm trying to compile a program in Objective C on Ubuntu, I have installed GNUstep, set all the GNUSTEP_*
environment variables, and installed clang, because I read that gcc can't compile Objective-C code with blocks (Objective-C 'anonymous' functions, just to be clear: ^ { }
).
What I get when I run this command:
clang hello.m -o hello
Is:
hello.m:1:9: fatal error: 'Foundation/Foundation.h' file not found
#import <Foundation/Foundation.h>
^
1 error generated.
I tried this also:
clang -L '/usr/include/GNUstep/Foundation/Foundation.h' hello.m -o hello
Where /usr/include/...
is the path to the Foundation.h file on my system; but I still get the same result.
How can I link those header files automatically and compile Objective-C?
Thanks!
-L
is used to specify a library directory, i.e. the location of a .so or .dylib file whose name you also supplied using-l
. Perhaps you were thinking of-I/usr/include/GNUstep
; that would tell it where the root directory for include files is. In no case would you supply the full path to the actual library or header file (well, it is possible to supply a path to library files, but it's rarely done). – Lao