我们正在使用cocos2d-x为Android和IOS做一场游戏。为此我们遵循了http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started链接。 一切都工作正常,除非我们尝试将LevelHelper链接/包含到我们的项目中,它抛出错误
undefined reference to `LevelHelperLoader::LevelHelperLoader(char const*)'
以下是Android.mk文件
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := game_shared
LOCAL_MODULE_FILENAME := libgame
LOCAL_SRC_FILES := helloworld/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \
$(LOCAL_PATH)/../../../Box2D \
$(LOCAL_PATH)/../../Classes/LevelHelper \
$(LOCAL_PATH)/../../Classes/LevelHelper/
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static box2d_static
include $(BUILD_SHARED_LIBRARY)
$(call import-module,CocosDenshion/android) $(call import-module,cocos2dx) $(call import-module,Box2D)
我们不知道哪里出错了。任何线索都非常有用。
答案 0 :(得分:0)
我认为LevelHelper只与iOS的cocos2d-x兼容,仅适用于Mac,尚未在Android平台上测试过。在cocos2d-x网站上,它没有说任何关于android的进展。这是链接http://www.cocos2d-x.org/news/14
答案 1 :(得分:0)
最后我得到了答案。我需要将.cpp
的所有LevelHelper
个文件添加到Android.mk
,如下所示
LOCAL_SRC_FILES := helloworld/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp \
../../Classes/LevelHelper/LevelHelperLoader.cpp \
../../Classes/LevelHelper/Utilities/LHDictionary.cpp \
../../Classes/LevelHelper/Utilities/LHObject.cpp \
../../Classes/LevelHelper/Utilities/LHArray.cpp \
../../Classes/LevelHelper/Nodes/SHDocumentLoader.cpp \
../../Classes/LevelHelper/Nodes/LHSprite.cpp \
../../Classes/LevelHelper/Nodes/LHTouchMgr.cpp \
../../Classes/LevelHelper/Nodes/LHSettings.cpp \
../../Classes/LevelHelper/Nodes/LHPathNode.cpp \
../../Classes/LevelHelper/Nodes/LHParallaxNode.cpp \
../../Classes/LevelHelper/Nodes/LHNode.cpp \
../../Classes/LevelHelper/Nodes/LHLayer.cpp \
../../Classes/LevelHelper/Nodes/LHJoint.cpp \
../../Classes/LevelHelper/Nodes/LHFixture.cpp \
../../Classes/LevelHelper/Nodes/LHCuttingEngineMgr.cpp \
../../Classes/LevelHelper/Nodes/LHCustomSpriteMgr.cpp \
../../Classes/LevelHelper/Nodes/LHContactNode.cpp \
../../Classes/LevelHelper/Nodes/LHContactListener.cpp \
../../Classes/LevelHelper/Nodes/LHContactInfo.cpp \
../../Classes/LevelHelper/Nodes/LHBezier.cpp \
../../Classes/LevelHelper/Nodes/LHBatch.cpp \
../../Classes/LevelHelper/Nodes/LHAnimationNode.cpp \
../../Classes/LevelHelper/CustomClasses/LHUntitledClass.cpp \
../../Classes/LevelHelper/CustomClasses/TemporaryDummyClass.cpp
如需进一步的帮助,请参阅this链接。希望它也能帮助其他用户。