#error "You must define either CC_ENABLE_CHIPMUNK_INTEGRATION or CC_ENABLE_BOX2D_INTEGRATION to use CCPhysicsSprite.h"

Hi guys,

I was trying to build cocos2d-x project for android.

After creating the android project, I modified the Android.mk inside the jni directory as following:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

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

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

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES *= box2d_static
include $
$
$
$
$
——————————————————————-
While executing the build_native.sh, I got errors:

Compile*+ thumb : game_shared <= main.cpp
Compile*+ thumb : game_shared <= AppDelegate.cpp
Compile*+ thumb : game_shared <= HelloWorldScene.cpp
Compile++ thumb : cocos_extension_static <= CCPhysicsSprite.cpp
In file included from D:/android/cocos2d-x/Cocos2d_x_Android/proj.android/…/…/extensions/physics_nodes/CCPhysicsSprite.cpp:23:0:
D:/android/cocos2d-x/Cocos2d_x_Android/proj.android/…/…/extensions/physics_nodes/CCPhysicsSprite.h:33:2: error: #error “You must define either CC_ENABLE_CHIPMUNK_INTEGRATION or CC_ENABLE_BOX2D_INTEGRATION to use CCPhysicsSprite.h”
/cygdrive/D/android/android-ndk-r8e/build/core/build-binary.mk:272: recipe for target `obj/local/armeabi/objs/cocos_extension_static/physics_nodes/CCPhysicsSprite.o’ failed
make: * [obj/local/armeabi/objs/cocos_extension_static/physics_nodes/CCPhysicsSprite.o] Error 1
make: Leaving directory `/cygdrive/D/android/cocos2d-x/Cocos2d_x_Android/proj.android’


擷取.PNG (29.2 KB)

add 【#define CC_ENABLE_BOX2D_INTEGRATION】before 【#if CC_ENABLE_CHIPMUNK_INTEGRATION】in CCPhysicsSprite.h

add whare?

#ifndef PHYSICSNODES_CCPHYSICSSPRITE_H
#define PHYSICSNODES_CCPHYSICSSPRITE_H

#include “cocos2d.h”
#include “ExtensionMacros.h”

#if CC_ENABLE_CHIPMUNK_INTEGRATION
#include “chipmunk.h”
#elif CC_ENABLE_BOX2D_INTEGRATION
class b2Body;
#else // CC_ENABLE_BOX2D_INTEGRATION
#error “You must define either CC_ENABLE_CHIPMUNK_INTEGRATION or CC_ENABLE_BOX2D_INTEGRATION to use CCPhysicsSprite.h”
#endif

Add CC_ENABLE_BOX2D_INTEGRATION=1 as a preprocessor directive. Project Properties>C/C++>Preprocessor>^Preprocessor Definitions.

Do you know how to disable both? I do not need any physics :slight_smile:

Hi ! Did you solve this problem?
tell me how to do ,please!
I met the same problem with you!

Hey guys:
i have solve this problem!
and it`s very simple
step:
open proj.android\jni\Application.mk
add -D CC_ENABLE_BOX2D_INTEGRATION or CC_ENABLE_CHIPMUNK_INTEGRATION

like this:

Hey guys:
i have solve this problem!
and it`s very simple
step:
open proj.android\jni\Application.mk
add -D CC_ENABLE_BOX2D_INTEGRATION or CC_ENABLE_CHIPMUNK_INTEGRATION

like this:

bin zhang wrote:

Hey guys:
i have solve this problem!
and it`s very simple
step:
open proj.androidjniApplication.mk
add ~~D CC_ENABLE_BOX2D_INTEGRATION or CC_ENABLE_CHIPMUNK_INTEGRATION
>
like this:
>

i have sole the problem like this:
APP_STL := gnustl_static
APP_CPPFLAGS :=~~frtti DCOCOS2D_DEBUG=1DCC_ENABLE_CHIPMUNK_INTEGRATION=1
:smiley:

Add CC_USE_PHYSICS=0; to the precompiler options of the cocos2d lib.
If you don’t want scripting either: CC_ENABLE_SCRIPT_BINDING=0;

Hope this helps :smile:

thanks!!! you are nice