jni/. /.. /classes/appdelegate.cpp:102:error:undefined reference to ' Testcontroller::testcontroller

Source: Internet
Author: User

<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)  



jni/. /.. /classes/appdelegate.cpp:102:error:undefined reference to ' Testcontroller::testcontroller

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.