Box2d in cocos2dx 2.0 android project

Box2d in cocos2dx 2.0 android project
0.0 0



I really need some help with android project setup. Everything works when I am not using Box2d in the project. Here is what I’ve done so far:

  1. I followed the tutorial
  2. In the tutorial above I added the -b option to script

Now, when I am trying to include Box2D.h in HelloWorldScene I get the No such file or directory error.

My mk file is as follows:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared


LOCAL_SRC_FILES := helloworld/main.cpp …/…/Classes/AppDelegate.cpp …/…/Classes/HelloWorldScene.cpp


LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static box2d_static


$(call import-module,CocosDenshion/android) $(call import-module,cocos2dx) $(call import-module,Box2D)

It would be very nice if someone could provide a step-by-step guide on how to setup cocos2dx android project with Box2D.



I found the solution.

If I use:

#include “Box2D/Box2D.h”

instead of

#include “Box2D.h”

it works on both: Android and iPhone.

Any explenations are welcome.



I’m having the same problem as you and I’m trying to declare a b2World, but when I write
Box2D::b2World* world; my game wont compile.