我在cocos2d-x win32项目上工作了很长时间。新的我想把我的项目移植到Android项目。我将proj.android
导入Eclipse并解决了一些错误。很遗憾,我不小心删除了includes
下的一些project properties>C/C++ general>Paths and Symbols>Includes
。现在我遇到了这个错误。我该怎么解决呢我使用的是cocos2d-x 2.1.5和Android NDK r8e。
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: error: ./obj/local/armeabi/libcocos2d.a: member at 8799706 is not an ELF object
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/liblua.a(LuaCocos2d.o): in function tolua_Cocos2d_CCEGLViewProtocol_getScaleY00(lua_State*):D:\graduation_project\cocos2d-x-2.1.5/scripting/lua/proj.android/../cocos2dx_support/LuaCocos2d.cpp:8905: error: undefined reference to 'cocos2d::CCEGLViewProtocol::getScaleY() const'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/liblua.a(LuaCocos2d.o): in function tolua_Cocos2d_CCEGLViewProtocol_getScaleX00(lua_State*):D:\graduation_project\cocos2d-x-2.1.5/scripting/lua/proj.android/../cocos2dx_support/LuaCocos2d.cpp:8873: error: undefined reference to 'cocos2d::CCEGLViewProtocol::getScaleX() const'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/liblua.a(LuaCocos2d.o): in function tolua_Cocos2d_CCEGLViewProtocol_getViewPortRect00(lua_State*):D:\graduation_project\cocos2d-x-2.1.5/scripting/lua/proj.android/../cocos2dx_support/LuaCocos2d.cpp:8841: error: undefined reference to 'cocos2d::CCEGLViewProtocol::getViewPortRect() const'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libextension.a(CCScrollView.o): in function .LTHUNK25:D:\graduation_project\cocos2d-x-2.1.5/extensions/GUI/CCScrollView/CCScrollView.cpp:38: error: undefined reference to 'cocos2d::CCEGLViewProtocol::getScaleX() const'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libextension.a(CCScrollView.o): in function .LTHUNK25:D:\graduation_project\cocos2d-x-2.1.5/extensions/GUI/CCScrollView/CCScrollView.cpp:38: error: undefined reference to 'cocos2d::CCEGLViewProtocol::getScaleY() const'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function cocos2d::CCEGLView::~CCEGLView():D:\graduation_project\cocos2d-x-2.1.5/cocos2dx/platform/android/CCEGLView.cpp:66: error: undefined reference to 'cocos2d::CCEGLViewProtocol::~CCEGLViewProtocol()'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function cocos2d::CCEGLView::CCEGLView():D:\graduation_project\cocos2d-x-2.1.5/cocos2dx/platform/android/CCEGLView.cpp:58: error: undefined reference to 'cocos2d::CCEGLViewProtocol::CCEGLViewProtocol()'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function typeinfo for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x8): error: undefined reference to 'typeinfo for cocos2d::CCEGLViewProtocol'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x30): error: undefined reference to 'cocos2d::CCEGLViewProtocol::getFrameSize() const'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x34): error: undefined reference to 'cocos2d::CCEGLViewProtocol::setFrameSize(float, float)'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x38): error: undefined reference to 'cocos2d::CCEGLViewProtocol::getVisibleSize() const'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x3c): error: undefined reference to 'cocos2d::CCEGLViewProtocol::getVisibleOrigin() const'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x40): error: undefined reference to 'cocos2d::CCEGLViewProtocol::setDesignResolutionSize(float, float, ResolutionPolicy)'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x44): error: undefined reference to 'cocos2d::CCEGLViewProtocol::getDesignResolutionSize() const'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x48): error: undefined reference to 'cocos2d::CCEGLViewProtocol::setTouchDelegate(cocos2d::EGLTouchDelegate*)'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x4c): error: undefined reference to 'cocos2d::CCEGLViewProtocol::setViewPortInPoints(float, float, float, float)'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x50): error: undefined reference to 'cocos2d::CCEGLViewProtocol::setScissorInPoints(float, float, float, float)'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x54): error: undefined reference to 'cocos2d::CCEGLViewProtocol::isScissorEnabled()'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x58): error: undefined reference to 'cocos2d::CCEGLViewProtocol::getScissorRect()'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x5c): error: undefined reference to 'cocos2d::CCEGLViewProtocol::setViewName(char const*)'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x60): error: undefined reference to 'cocos2d::CCEGLViewProtocol::handleTouchesBegin(int, int*, float*, float*)'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x64): error: undefined reference to 'cocos2d::CCEGLViewProtocol::handleTouchesMove(int, int*, float*, float*)'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x68): error: undefined reference to 'cocos2d::CCEGLViewProtocol::handleTouchesEnd(int, int*, float*, float*)'
D:/graduation_project/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/libcocos2d.a(CCEGLView.o): in function vtable for cocos2d::CCEGLView:CCEGLView.cpp(.data.rel.ro+0x6c): error: undefined reference to 'cocos2d::CCEGLViewProtocol::handleTouchesCancel(int, int*, float*, float*)'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libcocos2dcpp.so] Error 1
Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos2dcpp_shared
LOCAL_MODULE_FILENAME := libcocos2dcpp
LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/sqlite3.c \
../../Classes/AppDelegate.cpp \
../../Classes/BackgroundLayer.cpp \
../../Classes/Bujian.cpp \
../../Classes/Character.cpp \
../../Classes/HanziManage.cpp \
../../Classes/HcharacterDrawnode.cpp \
../../Classes/HcharacterLayer.cpp \
../../Classes/HclcData.cpp \
../../Classes/JudgeManager.cpp \
../../Classes/LianxiScene.cpp \
../../Classes/LuaScriptReader.cpp \
../../Classes/PopLayer.cpp \
../../Classes/ReadXML.cpp \
../../Classes/Splash.cpp \
../../Classes/Stroke.cpp \
../../Classes/StrokeDrawnode.cpp \
../../Classes/StrokeNode.cpp \
../../Classes/TcharacterDrawnode.cpp \
../../Classes/TcharacterLayer.cpp \
../../Classes/Tianzige.cpp \
../../Classes/TouchLayer.cpp \
../../Classes/WallScene.cpp \
../../Classes/tinystr.cpp \
../../Classes/tinyxml.cpp \
../../Classes/tinyxmlerror.cpp \
../../Classes/tinyxmlparser.cpp \
../../Classes/MoveToRightPlaceInterval.cpp \
../../Classes/SqliteHelper.cpp \
../../Classes/CharacterEntity.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes\
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
LOCAL_WHOLE_STATIC_LIBRARIES += box2d_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += luajit_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_lua_static
include $(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)
$(call import-module,scripting/lua/proj.android)
Application.mk
APP_STL := stlport_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1
APP_CFLAGS += -Wno-error=format-security
答案 0 :(得分:0)
error: undefined reference to
可能是由于Android.mk
我相信你在包含静态库的地方出现了语法错误:
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dx_static
应该是:
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static