4

I was just starting to study obj-c on Ubuntu Linux today, the tutorial that I followed is http://www.otierney.net/objective-c.html, when I typed in the code that requires for Foundation/NSObject.h, the error appeared:

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

and i searched for the solutions, and found a proper one gcc -o Fraction -I/usr/GNUstep/System/Library/Headers -L/usr/GNUstep/System/Library/Libraries Fraction.m -ldl -lobjc

I tried this, but I found that I cannot find Headers under the Library directory. (My folder of GNUstep is /usr/share/GNUstep).

Does anyone know how to achieve the Headers? I installed all the dev packages related to GNUstep but still no luck.

Hope I state my question clear enough. Sorry for my English.

hjbolide
  • 381
  • 4
  • 14

4 Answers4

1

Try with gnustep-config

gcc `gnustep-config --objc-flags` \
    `gnustep-config --objc-libs` Fraction.m -o Fraction
mathk
  • 7,973
  • 6
  • 45
  • 74
0

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

yum install gnustep-base
Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
0

In my case, compiling SOPE on CentOS 7, installed

yum install gnustep-base-devel

This solved the problem.

  • Do [edit] the post and clarify as to why gnustep-base-devel is needed and not gnustep-base, as the other answer has already pointed out – Bhargav Rao May 08 '19 at 18:56
0

GNUStep uses a fairly involved set of gmake macros - I wouldn't expect a simple command-line invocation of gcc to work very well, although to be honest I haven't tried that way myself. I found Nicolo Pera's tutorial and the project's own reference page to be quite useful when learning how to write make files for use with GNUStep.

Sherm Pendley
  • 13,556
  • 3
  • 45
  • 57
  • thanks for your answer, but I can't even find the Headers in my computer, which means I have no NSObject.h file in my system. any suggestion? – hjbolide Apr 15 '11 at 05:41
  • 1
    According to , NSObject.h is provided by the libgnustep-base-dev package - the gnustep-devel package includes that and a number of others in its dependencies, so I'd suggest installing that. – Sherm Pendley Apr 15 '11 at 06:18
  • Incidentally, according to the package manifest, NSObject.h and other Foundation headers should be in /usr/include/GNUstep/Foundation/ – Sherm Pendley Apr 15 '11 at 06:20
  • I surely installed that package, but still cannot find the headers, I tried find / -name NSObject.h, doesn't work either. – hjbolide Apr 15 '11 at 06:21