Reputation: 86097
I've added Box2D to a Cocos2D project I'm working on.
I've followed several guides as to how to do this (all of which seem to differ!). However, none seem to work.
I'm getting these types of errors:
error: Box2D/Collision/b2BroadPhase.h: No such file or directory
I assumed I'd got the Header Search Paths wrong but have tried all sorts of variants with no luck.
Any suggestions?
Upvotes: 2
Views: 1974
Reputation: 33126
Alternatively ... After a lot of trouble trying to include box2d in my project, I instead used box2d as a static library - takes a minute to setup, but it's much easier to maintain / add to multiple projects. Step by step guide here:
http://red-glasses.com/index.php/tutorials/box2d-for-ios-made-easy-make-it-a-static-library/
Upvotes: 0
Reputation: 7136
The easiest way to use Box2d with your project is to follow these lines:
That's all! You just have to be careful when you want to use Box2d. Think to change the extension of your files from .m to .mm to warn the compiler that the class must be compile as Objective-C++ instead of Objective-C.
I have found a good tutorial here (with Xcode 3.2, but the idea is here). I hope it'll help you.
Upvotes: 6