Problems in C++ header paths in xCode

Started by
0 comments, last by Quittouff 11 years, 7 months ago
Hi everyone,

We bought an iMac to port our game from PC to mac, and I'm a true beginner with xCode. Our (in-house) engine and game are fully in C++ and I'm currently trying to make the projects under xCode. But I'm not very far in the process as I spent my entire first day with a header path problem...

Note: I'm using xCode 4.4 under OS X 10.8.1 (Mountain Lion)

So the problem is that the compiler seems to mess up header paths. Here is the deal:

I have my xproject in Sources/MakeFiles/xCode/Base/base.xproject
I have all my project sources (headers and cpp) in Sources/Base/
Now I added all the files to the project, no problem, but it couldn't find the headers, so I go to the options, add ../../../ to "Header Search path" (so the root of the include directory is "Sources"), I don't check the recursive option, it now finds my headers.

But when I include <string> which includes <string.h>(via some nested headers like cstring), the compiler go for a file located in Sources/Base/String/String.h. But I haven't checked the "recursive" checkbox!

So I know I could rename my headers or change every includes to use "" instead of <>. But it's a fairly big project (2500+ files) and I really don't want to mess all up for something which looks like a bug on xCode part, or silly misuse on mine.

I tried a lot of things, including copying all system headers in a custom dir and adding this dir first in "Header Search path", it always includes my Base/String/String.h instead of <string.h>

Am I missing something? I feel so dumb! I spent nearly 12 hours on this, googling, trying tons of insane stuff, I'm in a dead end, please help!
Advertisement
Ok, it seems that I finally found a solution. Adding a custom Build setting "USE_HEADERMAP" set to NO stopped the confusion between headers. It seems that xCode uses a "magic recipe" to found your headers (the heade map), and this command disables it. Magic recipes are always baaaad :)

This topic is closed to new replies.

Advertisement