4

i wanted to install objective c compiler for ubuntu.
this site was used to install GNUstep on ubuntu. http://www.techotopia.com/index.php/Installing_and_Using_GNUstep_and_Objective-C_on_Linux then commands were written in following order in terminal-


sudo apt-get install gnustep  
sudo apt-get install gnustep-devel  

then,i wrote my sample code and saved it as hello.m


#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    NSLog (@"hello world");
    [pool drain];
    return 0;
}  

then,i typed in terminal


. /usr/share/GNUstep/Makefiles/GNUstep.

gcc `gnustep-config --objc-flags` -lgnustep-base hello.m -o hello  

then,an error message appeared that


gcc: gnustep-config --objc-flags: No such file or directory
hello.m:1:23: fatal error: Foundation.h: No such file or directory
compilation terminated.  

then,i wrote


sudo apt-get install gobjc  

then,terminal showed


Reading package lists... Done
Building dependency tree       
Reading state information... Done
gobjc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 205 not upgraded.

then,i again compiled but it showed again the same error.


hp@ubuntu:~$ gcc 'gnustep-config --objc-flags' -lgnustep-base hello.m -o hello
gcc: gnustep-config --objc-flags: No such file or directory
hello.m:1:23: fatal error: Foundation.h: No such file or directory
compilation terminated.  

so,need some help..

1 Answer 1

3

Try running:

gnustep-config --objc-flags

on its own to check if it returns error or appropriate gcc flags, etc.

Also, try finding the location for the include dir and add it explicitly with -Idir option to gcc

Sign up to request clarification or add additional context in comments.

3 Comments

@sagacious The flag you are looking for is probably a -I<path/to/foundatin/headers> or equivalent that lets the compiler find Foundation.h
@JeremyP Yes, thats what I meant (saw your comment after my edit :)
@ManishJhawar yeah.got it.i was unable to find path to fondation.h.thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.