Cocos2d-x android 编译错误 undefined reference to 'MenuScene::getInstance()'

前端之家收集整理的这篇文章主要介绍了Cocos2d-x android 编译错误 undefined reference to 'MenuScene::getInstance()'前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

原因:没有找到对应的MenuScene.cpp文件

虽然文件在../../Classes文 件夹里面,但是在Android.mk里面../../Classes只是头文件搜索路径,没有放到编译的文件里面。所以这里在链接的时候找不到对应的源文件
解决方案:修改Android.mk文件LOCAL_SRC_FILES,将

LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp

改成

LOCAL_SRC_FILES := hellocpp/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp \
../../Classes/MenuScene.cpp \

../../Classes/StartScene.cpp \
../../Classes/TopMenu.cpp \ ../../Classes/GameLayer.cpp \ ../../Classes/GameScene.cpp \ ../../Classes/WelcomeLayer.cpp \ ../../Classes/WelcomeScene.cpp \ ../../Classes/GameData.cpp \
原文链接:https://www.f2er.com/cocos2dx/344501.html

猜你在找的Cocos2d-x相关文章