-
daskrsLikes 0Problem Description
I follow the Cocos2d-x C++ Physics Course 13 tutorial. And works well on a gcc compiler. but when i try compile for a android device, i get this errors.
[armeabi] SharedLibrary : libcocos2dcpp.so /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: multiple definition of 'vtable for HelloWorld' /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: previous definition here /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: multiple definition of 'HelloWorld::createScene()' /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: previous definition here /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: multiple definition of 'HelloWorld::init()' /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: previous definition here /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: multiple definition of 'HelloWorld::onContactBegin(cocos2d::PhysicsContact&)' /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: previous definition here /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: multiple definition of 'HelloWorld::onTouchBegan(cocos2d::Touch*, cocos2d::Event*)' /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: previous definition here /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: multiple definition of 'typeinfo for HelloWorld' /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: previous definition here /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: multiple definition of 'typeinfo name for HelloWorld' /home/endrius/.Android/NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs-debug/cocos2dcpp_shared/__/__/Classes/HelloWorldScene.o: previous definition here jni/../../Classes/HelloWorldScene.cpp:172: error: undefined reference to 'MyBodyParser::getInstance()' jni/../../Classes/HelloWorldScene.cpp:172: error: undefined reference to 'MyBodyParser::parseJsonFile(std::string const&)' jni/../../Classes/HelloWorldScene.cpp:174: error: undefined reference to 'MyBodyParser::getInstance()' jni/../../Classes/HelloWorldScene.cpp:174: error: undefined reference to 'MyBodyParser::bodyFormJson(cocos2d::Node*, std::string const&, cocos2d::PhysicsMaterial)' jni/../../Classes/HelloWorldScene.cpp:172: error: undefined reference to 'MyBodyParser::getInstance()' jni/../../Classes/HelloWorldScene.cpp:172: error: undefined reference to 'MyBodyParser::parseJsonFile(std::string const&)' jni/../../Classes/HelloWorldScene.cpp:174: error: undefined reference to 'MyBodyParser::getInstance()' jni/../../Classes/HelloWorldScene.cpp:174: error: undefined reference to 'MyBodyParser::bodyFormJson(cocos2d::Node*, std::string const&, cocos2d::PhysicsMaterial)' collect2: error: ld returned 1 exit status make: *** [obj/local/armeabi/libcocos2dcpp.so] Error 1 make: Leaving directory `/home/endrius/Programacao/cocos/testes/MesaTestesPhysics/proj.android' Error running command, return code: 2. Traceback (most recent call last): File "./build_native.py", line 43, in build(opts.build_mode) File "./build_native.py", line 28, in build raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!") Exception: Build dynamic library for project [ /home/endrius/Programacao/cocos/testes/MesaTestesPhysics/proj.android/../ ] fails!
have u any clue of what's going on?
-
Sonar Systems adminLikes 0
Have you added the MyBodyParser files to your project?
-
daskrsLikes 0
yes, i did it.
in CMakeLists.txt file, ichange it
set(GAME_SRC Classes/AppDelegate.cpp Classes/HelloWorldScene.cpp Classes/MyBodyParser.cpp ${PLATFORM_SPECIFIC_SRC} ) set(GAME_HEADERS Classes/AppDelegate.h Classes/HelloWorldScene.h Classes/MyBodyParser.h ${PLATFORM_SPECIFIC_HEADERS} )
and in Android.mk i add here
LOCAL_SRC_FILES := hellocpp/main.cpp \ ../../Classes/AppDelegate.cpp \ ../../Classes/HelloWorldScene.cpp \ ../../Classes/HelloWorldScene.cpp
yep.. was a stupid error.. >.<
well tnks for reply error fixed now.
This reply has been verified.
-
Sonar Systems adminLikes 0
COOL
-
thalisvilelaLikes 0
There is any comand i can use to automatically update cMake and Android.mk?
-
Sonar Systems adminLikes 0
Not that I know of, sorry. It would be cool if there was.
Login to reply