1

I can run my code in vc2012. I need to compile my code to android so I use linux system to run ./build_native.sh . Then terminal turn out this

StaticLibrary  : libchipmunk.a
Compile thumb  : cpufeatures <= cpu-features.c
StaticLibrary  : libcpufeatures.a
SharedLibrary  : libgame.so
/myData/Data/JAVA/adt-bundle-linux-x86_64-20130717/android-ndk-r8e/toolchains/arm-linux-      androideabi-4.6/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-     androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/game_shared/__/__/Classes/AppDelegate.o: in function AppDelegate::applicationDidFinishLaunching():jni/../../Classes/AppDelegate.cpp:29: error:  undefined reference to 'CPWScene::createScene()'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libgame.so] Error 1
make: Leaving directory `/myData/Workspace/C++/cocos2d-2.1rc0-x-2.1.3/Workspace/ClassDesgin/proj.android'
3DKS
  • 109
  • 2
  • 9

1 Answers1

4

You have to add CPWScene.cpp file to Android.mk file so that compiler can compile the file. Android.mk file is located in proj.android/jni folder. In order to compile your project you need to list all your cpp files in Android.mk file.