使用cocos compile -p android編譯cocos2dx項目的時候出現以下錯誤(新建了TestScene.h,TestScene.cpp):android
jni/../../Classes/AppDelegate.cpp:79: error: undefined reference to 'TestScene::createScene()' clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation) make.exe: *** [obj/local/armeabi/libMyGame.so] Error 1 make.exe: Leaving directory `D:/projects/HelloWorldCpp/proj.android' 執行命令出錯,返回值:2。
編輯proj.android/jni/目錄下的Android.mk文件,在spa
LOCAL_SRC_FILES := hellocpp/main.cpp \ ../../Classes/AppDelegate.cpp \ ../../Classes/HelloWorldScene.cpp
處追加上你全部新建的文件(我這裏是TestScene.cpp),從新編譯,經過。code