PDA

View Full Version : using includes with include path




eddyq
Aug 10, 2009, 04:54 PM
The compiler does not find config/config.h

I have an include like this:
#include <config/config.h>
My project is at the same level as the "config" folder.
In Project->Edit Active Target "xxx" I entered the search paths under Search Paths->Header Search Paths as ".". I also tried "./" and I also tried just eliminting the path.
I have verified that config/config.h is available.
It does not find config.h.
I then copied config.h into the level above (same level as the project) and the compiler finds it for all cases of ".", "./" and nothing.

So my question is ... with an include as above, what is the correct procedure to get the compiler to find the given .h file? (note that on other systems such as NetBSD and Linux the include directive is the correct format).



eddyq
Aug 10, 2009, 07:07 PM
Never mind ... I didn't realize that when I made the project it made a new folder for the xcodeproj file. So instead of "." I have to use "..".

eddyq
Aug 11, 2009, 10:34 AM
Well I spoke too soon. Using .. does not work. Does anyone know how to specify the above mentioned include path?

SRossi
Aug 11, 2009, 11:02 AM
Is it a framework or is it just a normal header file.

If it is just a header file have u self created it or is it a system created header?

Stephen

eddyq
Aug 11, 2009, 11:19 AM
The headers are my own headers.

Desktop
-top_level_folder
--foo
---foo.h
---bar.h
---foo.c
--baz
---baz.h
--project_folder
---name.xcodeproj


Throughout the source, header files are included like "#include <foo/foo.h>", "#include <baz/baz.h>"

I have added ".." to the Project->Edit Active Target "name"->Search Paths->Header Search Paths. I also tried using /Users/eddyq/Desktop/top_level. I also tried ".".

I just can't get the compiler to find the the .h files.

chown33
Aug 11, 2009, 01:05 PM
The headers are my own headers.
...

Throughout the source, header files are included like "#include <foo/foo.h>", "#include <baz/baz.h>"


When you enclose the header name in < >, it means a system include. For user includes, i.e. ones you provide, you should be using "foo/foo.h", and you should specify a user-include path that contains the "foo" folder where "foo.h" can be found.