<1> error message:
[Armeabi] SharedLibrary:libcocos2dcpp.so
e:/android/android-ndk-r9d/toolchains/arm-linux-androideabi-4.6/prebuilt/windows/bin/. /lib/gcc/arm-linux-androideabi/4.6/. /.. /.. /.. /arm-linux-androideabi/bin/ld.exe:./obj/local/armeabi/objs/cocos2dcpp_shared/__/__/classes/appdelegate.o:in function appdelegate::applicationdidfinishlaunching (): jni/. /.. /classes/appdelegate.cpp:102:error:undefined reference to ' Testcontroller::testcontroller () '
Collect2:ld returned 1 exit status
Make.exe: * * * [obj/local/armeabi/libcocos2dcpp.so] Error 1
<2> Solutions
The way to solve the problem is in ANDROID.MK:
Local_src_files: = hellocpp/main.cpp \
.. /.. /classes/appdelegate.cpp \
.. /.. /classes/helloworldscene.cpp \
Add the. cpp file file that you want to compile in the following:
Local_path: = $ (call My-dir) include $ (clear_vars) Local_module: = Cocos2dcpp_sharedlocal_module_filename: = Libcocos2dcpplocal_src_files: = Hellocpp/main.cpp. /.. /classes/appdelegate.cpp. /.. /classes/controller.cpp. /.. /classes/helloworldscene.cpp. /.. /classes/testbasic.cpp. /.. /classes/visiblerect.cpp. /.. /classes/actioneasetest/actioneasetest.cpp. /.. /classes/actiontest/actiontest.cpp. /.. /classes/clickandmovetest/clickandmovetest.cpp. /.. /classes/nodetest/nodetest.cpp. /.. /classes/transitionstest/transitionstest.cpp local_c_includes: = $ (local_path)/... /.. /classeslocal_whole_static_libraries + = cocos2dx_staticlocal_whole_static_libraries + cocosdenshion_staticLOCAL_ Whole_static_libraries + = box2d_staticlocal_whole_static_libraries + chipmunk_staticlocal_whole_static_libraries + = Cocos_eXtension_staticinclude $ (build_shared_library) $ (call IMPORT-MODULE,COCOS2DX) $ (Call import-module,cocos2dx/ Platform/third_party/android/prebuilt/libcurl) $ (call Import-module,cocosdenshion/android) $ (call Import-module, Extensions) $ (call import-module,external/box2d) $ (call Import-module,external/chipmunk)
If there are too many CPP files, it will be a hassle to add up, so I found a better solution on the Internet:
Using the Android.mk file below, Nothing is added, OK, no matter how much the. cpp file is compiled .
Local_path: = $ (call My-dir) include $ (clear_vars) local_module: = game_shared Local_module_filename: = Libgame file_list: = hellocpp/main.cpp file_list + + $ (wildcard $ (local_path)/.. /.. /classes/*.cpp) Local_src_files: = $ (file_list:$ (Local_path)/%=%) local_c_includes: = $ (local_path)/... /.. /classes local_whole_static_libraries: = cocos2dx_static cocosdenshion_static cocos_extension_static Include $ (build_shared_library) $ (call import-module,cocosdenshion/android) \ $ (call Import-module, COCOS2DX) \ $ (call import-module,extensions)