1

I installed GNUStep on Ubuntu 12.10, and some tools for Objective-C development. I then tried to compile the following code.

#import <Foundation/Foundation.h>

int main(int *argc, const char *argv[]) {
  NSAutorelease *pool = [[NSAutorelease alloc] init];
  NSLog(@"hello world");
  [pool drain];
  return 0;
}

When I compile it with gcc -o hello hello.m -Wall -lobjc, I get the following error.

Foundation/Foundation.h: No such file or directory; compilation terminated.

I find the Foundation library and other libraries in /usr/include/GNUstep/Foundation. Why am I getting that error message?

apaderno
  • 28,547
  • 16
  • 75
  • 90
Sarah Zeftawy
  • 39
  • 1
  • 3
  • 1
    Can you show `hello.m`. My first guess is that you used `#include "Foundation/Foundation.h"` not `#include `. – gaige Apr 03 '13 at 21:43
  • Look here: http://ubuntuforums.org/showthread.php?t=890425 also make sure that you have gnustep installed. – Ramy Al Zuhouri Apr 03 '13 at 23:52
  • You should build it with GNUstep-make package which use GNUmakefile and here's how to write one http://www.gnustep.it/nicola/Tutorials/WritingMakefiles/index.html And if you want Objective-C 2.0, arc, literals, all the neat stuffs you should switch to clang. – Fred Frith-MacDonald Apr 04 '13 at 09:57

0 Answers0