saurabh kabra
saurabh kabra

Reputation: 75

installing objective c compiler

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..

Upvotes: 4

Views: 5296

Answers (1)

Manish Jhawar
Manish Jhawar

Reputation: 130

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

Upvotes: 3

Related Questions