I have a working Xcode project that includes Cocos2d in one of the views. I now need to add Box2d. I tried dragging the Box2D folder into the libs directory of my cocos2d-2.x-ARC-iOS folder and adding to that target, but I'm getting this when I compile:
(in b2BroadPhase.cpp)
'Box2D/Collision/b2BroadPhase.h' file not found
I'm sure this is just the first of many errors I will get. What step am I missing to get all the Box2d files compiled in my project?
All of the box2d files are listed in the Compile Sources for the cocos2d-library target.
And why is this so difficult to do? Why doesn't it work like any other library?
AND - do I have to rename every single .m in my project to .mm? That's pretty much impossible as this is a large xcode project with many files. I'm just trying to use Box2d in one view.
Additional info in response to the answer given by LearnCocos2D-
My folder structure (in Finder) looks like this:
Root = MyProject.xcodeproj, MyProject folder, cocos2d-2.x-ARC-iOS folder In the cocos2d-2.x-ARC-iOS folder there is a folder called libs. Inside that folder I have the Box2D folder, along with Cocos2d, CocosDenshion, etc.
In XCode I have a PROJECT (MyProject) And 2 TARGETS (cocos2d-library, MyProject) There are "Header Search Paths" for both the PROJECT, and the TARGETS. Which one do I set? And should it be recursive or non? And when I drag the Box2D folder into Xcode, which target do i set it to?
My project file is located at /Users/me/Dropbox/iOS/MyProject. So what exactly do I enter for the Header Search Path? /Users/me/Dropbox/iOS/MyProject/cocos2d-2.x-ARC-iOS/libs doesn't seem to work.
Another Update - /Users/me/Dropbox/iOS/MyProject/cocos2d-2.x-ARC-iOS/libs as the Header Search Path in the MyProject TARGET seems to get me past the Box2D errors. Then I had a 'cassert' file not found error. Got past that by changing the view controller, it's parent, and the AppDelegate to a File Type of "Objective-C++ Source" like you suggested. And now...
Now I've got a litany of errors in NSObjCRuntime.h NSZone.h, NSObject (Expected unqualified-id, Unknown type name 'NSString', etc.). So it seems like you either create an app with Box2d/Cocos2d, or a UIKit app. Trying to have both is a complete nightmare.