0

我们正在使用 cocos2d-x 为 Android 和 IOS 做 1 款游戏。为此,我们关注了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)

我们不知道我们哪里出错了。任何线索都非常有帮助。

4

2 回答 2

0

我认为 LevelHelper 只兼容 cocos2d-x for iOS,仅限 Mac,还没有人在 android 平台上测试过。而在cocos2d-x网站上,并没有说android有什么进展。这是链接http://www.cocos2d-x.org/news/14

于 2012-09-25T23:08:36.457 回答
0

最后我得到了这个答案。我需要在下面添加所有.cpp文件LevelHelperAndroid.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

如需进一步帮助,请参阅链接。希望它也可以帮助其他用户。

于 2012-09-27T09:37:18.547 回答