I have a problem including box2D to my cocos2d project. I've tried different ways to do it with no success. This is what I've done:
- I downloaded Box2D (Box2D_v2.2.1) to my project directory.
- Dragged the Box2D directory (which includes -> /Box2D.h, /Collision, /Common, /Dynamics, /Rope) to my Xcode project (from Finder to Xcode)
- Then I added #include "Box2D.h" to my .h file and got many errors... Here is where I started my research :P
- I went to Project Settings and edited the attribute Header Search Paths (contained in the Search Paths section) specifying the path of Box2D. At this point, I builded the project and I got less errors.
- After that, I renamed my .m file to .mm (I think this is because Box2D is written in C++ and with this, the compiler can treat it as it is). Still got errors.
- Then I tried changing the attribute Always Search User Paths (contained in Project Settings -> Search Paths) from YES to NO. Still got errors.
- As my last option I tried changing the attribute Compile Sources As (contained in Project Settings -> LLVM GCC 4.2 - Language) from According to File Type to Objective-C++.
By now I'm frustrated xD. I have 203 errors and most of them are in the .h files contained in the Box2d engine.
b2Timer.h - Expected '=', ',', ';', 'asm' or 'attribute' before 'b2Timer'
b2Distance.h - Expected specifier-qualifier-list before 'b2DistanceProxy'
b2Math.h - Cfloat: No such file or directory
And so on...
Thanks!!!