Trying to figure out Xcode directory system
I'm a bit s开发者_运维问答tuck trying to get box2D to compile and I think it's because I don't quite understand how Xcode handles its build directories.
Box2D is folder containing a set of header and source files (in various subdirectories, etc). I've added the Box2D folder to a coco touch static library project in Xcode and when I try to compile I get errors about header files not being found such as <Box2D/Common/b2BlockAllocator.h>
.
I found that if I simply include the header with #include "b2BlockAllocator.h"
it compiles fine and Xcode actually finds the file.
So I'm a bit stuck here, I'm assuming I need to find a way to get all includes to begin searching from the root project directory and not from the source files location but I'm not sure how I can do that in Xcode...
Any ideas?
<Box2D/Common/b2BlockAllocator.h>
should be found in a directory called Box2D/Common
. You said that Box2D contains a set of header and source files. Are some of these headers in a subdirectory of Box2D
called Common
, or are they all directly under Box2D
? If it's the latter, then that's your problem.
OK I figured it out!
In the targets settings page look for 'header search paths' and add the root build directory of your project to it.
精彩评论