0

I am trying to compile a c++ library in Xcode but I am getting "file not found" errors for the .h files

#include <Class.h> does not give any errors

but

#include <path/to/Class.h> gives a file not found error.

Any idea how I can fix it?

sepp2k
  • 363,768
  • 54
  • 674
  • 675
Ashish Awaghad
  • 2,822
  • 3
  • 24
  • 33
  • 1
    Unless the *parent* folder of `path/to` is in your system header include folder path, `#include ` isn't going to work. Ex: Given the path `/some/path/to`, the folder `/some` should be specified in the system header include path. [**See this question**](http://stackoverflow.com/questions/20157365/xcode-5-how-to-add-header-search-path-and-use-gdataxmlnode) for an example of adding the path to your project header path list. – WhozCraig Aug 11 '14 at 07:34
  • the folder /some is already a part of the project. It is inside a folder named src inside the project's root folder. I added ${SRCROOT}/src/** to header search path. I still get the same error. – Ashish Awaghad Aug 11 '14 at 07:42
  • *Which* header search path. I just created a project, and under the source root I created `stuff/more/Header.h`, adding it to the project. I then added `$(SRCROOT)/stuff` to the *target* Header Search Path, and can now `#include ` without incident. Not sure what your problem with doing the same is. – WhozCraig Aug 11 '14 at 07:49
  • are you using the #include in a cpp class or an objective-c class? Basically, I have just taken the library and added to new Xcode project for testing the library. The library itself is not compiling. The #include statements I am referring to are in cpp classes in the library. – Ashish Awaghad Aug 11 '14 at 07:52
  • Straight-up C++ console application for OSX. – WhozCraig Aug 11 '14 at 07:53
  • I am trying to run it in an iOS project – Ashish Awaghad Aug 11 '14 at 08:04
  • Should work the same in either. Xcode has a Ui path-expander when typing in file names in `#include` braces, once you start one, you can kind of "back out" and see what is available. Someone that has never used Xcode probably thinks I'm speaking a foreign language, but if you've done it, you know what I mean. Its helpful in seeing the paths you think you have available and what is *really* there. It may help you in troubleshooting your path woes. – WhozCraig Aug 11 '14 at 08:08
  • I know what you mean. but when I type '#import – Ashish Awaghad Aug 11 '14 at 08:16

0 Answers0