1
votes

I'm trying to build cocos2d-x hello world project using build_native.sh, it shows me some compile errors. it seems that NDK can't find cocos2d-x sources.first it says:

NDK_ROOT = /cygdrive/c/Android-NDK-r4/android-ndk-r4-crystax
COCOS2DX_ROOT = /cygdrive/c/cocos2d-x/cocos2d-cocos2d-x-6e84662/firstapp/proj.android/../..
APP_ROOT = /cygdrive/c/cocos2d-x/cocos2d-cocos2d-x-6e84662/firstapp/proj.android/..
APP_ANDROID_ROOT = /cygdrive/c/cocos2d-x/cocos2d-cocos2d-x-6e84662/firstapp/proj.android

then:

Compile++ thumb: game_shared <= /cygdrive/c/cocos2d-x/cocos2d-cocos2d-x-6e84662/firstapp/proj.android/jni/hellocpp/main.cpp
In file included from /cygdrive/c/cocos2d-x/cocos2d-cocos2d-x-6e84662/firstapp/proj.android/jni/hellocpp/main.cpp:1:
/cygdrive/c/cocos2d-x/cocos2d-cocos2d-x-6e84662/firstapp/proj.android/jni/../../Classes/AppDelegate.h:4:27: error: CCApplication.h: No such file or directory
/cygdrive/c/cocos2d-x/cocos2d-cocos2d-x-6e84662/firstapp/proj.android/jni/hellocpp/main.cpp:2:44: error: platform/android/jni/JniHelper.h: No such file or directory
In file included from /cygdrive/c/cocos2d-x/cocos2d-cocos2d-x-6e84662/firstapp/proj.android/jni/hellocpp/main.cpp:6:
/cygdrive/c/cocos2d-x/cocos2d-cocos2d-x-6e84662/firstapp/proj.android/jni/../../Classes/HelloWorldScene.h:4:21: error: cocos2d.h: No such file or directory

and many more compile errors.

I used cocos2dx website tutorial, I'm using API 10(android 2.3.3) and windows 7 . can anyone help me?

5

5 Answers

0
votes

Try including <Cocos2d-x Root Folder>\cocos2dx\platform\ under Right Click->Properties->C\C++ general->path and symbols-> source folder -> Link Folder It is not able to find CCApplication.h file which could be found under <Cocos2d-x Root Folder>\cocos2dx\platform\android . Hope this helps.

0
votes

COCOS2DX_ROOT = /cygdrive/c/cocos2d-x/cocos2d-cocos2d-x-6e84662/firstapp/proj.android/../.. make sure that cocos2dx files are available at that location.

0
votes

Try including Cocos2dx folder in your Android.mk file, the error is telling that it cannot find the source file CCApplication.h which is in the cocos2dx folder.

0
votes

first import the library of cocos2d-x in the eclicips path of lib D:\cocos2d-x-2.2\cocos2dx\platform\android

then

Add the library of cocos2d-x in your project.

0
votes

In buid_native.sh file, around line 55, there is $COCOS2DX_ROOT defined with default path like '../../../', which means it will search COCOS2D_ROOT just relative to its current directory. So have a look at that first.