Box2D.h: No such file or directory


#1

Hello guys,
I just move to cocos2dX from cocos2d-iphone .
and i got my project works on iphone ,but when i run “./build_native.sh” to build it on android the “Box2D.h: No such file or directory” error shows ,
this is my Android.mk
"
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

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

LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes

LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
include $(BUILD_SHARED_LIBRARY)

$(call import-module,cocos2dx)
$(call import-module,cocos2dx/platform/third_party/android/prebuilt/libcurl)
$(call import-module,external/Box2D)
$(call import-module,CocosDenshion/android)
$(call import-module,extensions)
$(call import-module,external/chipmunk)
"
what should i do im stuck :frowning: any suggestions ?
I’m on v2.2.3


#2

You need to include like this

#include "Box2D/Box2D.h"

Because external/Box2D/Android.mk exported path like this

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..

And you can comment the lib you don’t use, such as chipmunk. I think you don’t need Box2D and chipmunk at the same time.
Right?


#3

And welcome to join cocos2d-x family.


#4

Thank you @Zhangxm :slight_smile:


#5

My pleasure.