开发者

Compiling Box2D in Xcode, build directory issues

开发者 https://www.devze.com 2023-03-22 19:30 出处:网络
I\'m a bit stuck here, basically I\'m trying to compile Box2D as a static cocos library. I started by creating a static library project in xcode4 and dragged in the source files (in the correct folder

I'm a bit stuck here, basically I'm trying to compile Box2D as a static cocos library. I started by creating a static library project in xcode4 and dragged in the source files (in the correct folder hierarchy) into the project. When I compile though I get a whole load of errors in regards to the header files not being found.

So all these header files being looked for in b2GearJoint.cpp are not found:

#include <Box2D/Dynamics/Joints/b2GearJoint.h>
#include <Box2D/Dynamics/Joints/b2RevoluteJoint.h>
#include <Box2D/Dynamics/Joints/b2PrismaticJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>

I figured this should be straight forward enough to fix, I just need to include the root box2d folder in the pre-included directories s开发者_开发技巧o it knows where to look. So I added the project root directory to the search path header section but i still get the same errors.

This may actually have a straightforward solution but I'm new to xcode 4 (usually a visual studio user)...


For Box2D you will have to add the Box2D path to the "User Header Search Paths" and not the "Header Search Paths" (without "User") setting.

This is because Box2D uses the angle bracket includes throughout the code instead of the more correct "file.h".


I've resolve my problem with deleting spaces in folder names. My path was like user/documents/my project/my project/ I've change it to user/documents/myproject/myproject/. And this helps me!


I couldn't get the static library approach to work for box2d, using ANY combination of User/non-User search paths.

In the end, I found it's because Xcode 4 delets the header folders, unless you force it to do the right thing.

Step by step instructions (long, with screenshots):

http://red-glasses.com/index.php/tutorials/box2d-for-ios-made-easy-make-it-a-static-library/

0

精彩评论

暂无评论...
验证码 换一张
取 消