码迷,mamicode.com
首页 > 其他好文 > 详细

cocos2d-x发生undefined reference to `XX'异常 一劳永逸解决的方法

时间:2019-03-17 20:05:21      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:statistic   声明   one   dev   enc   styles   sid   link   file   

转自:http://www.myexception.cn/operating-system/1620542.html

cocos2d-x发生undefined reference to `XX‘错误 一劳永逸解决方法

參考文章:

http://blog.csdn.net/kafeidev/article/details/9157895

http://blog.csdn.net/fu_zk/article/details/12836431



eclipse cocos2dx项目。出现错误

[plain]?view plaincopyprint?
  1. E:/Acocos2d-x/cocos2d-1.0.1-x-0.11.0/MyBilliard/android/jni/../../Classes/HelloWorldScene.cpp:27:?undefined?reference?to?`GameLayer::GameLayer()‘??
  2. E:/Acocos2d-x/cocos2d-1.0.1-x-0.11.0/MyBilliard/android/jni/../../Classes/HelloWorldScene.cpp:27:?undefined?reference?to???

原因是android的nkd编译须要将每一个cpp尽心进行声明

进入jni-->Classes文件夹下的Android.mk

[plain]?view plaincopyprint?
  1. LOCAL_SRC_FILES?:=?AppDelegate.cpp?\??
  2. ???????????????????HelloWorldScene.cpp??

改动成


例如以下:

[plain]?view plaincopyprint?

  1. LOCAL_MODULE_FILENAME := libcocos2dcpp


    MY_CPP_LIST := $(wildcard $(LOCAL_PATH)/*.cpp)
    MY_CPP_LIST += $(wildcard $(LOCAL_PATH)/hellocpp/*.cpp)
    MY_CPP_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp)


    LOCAL_SRC_FILES := $(MY_CPP_LIST:$(LOCAL_PATH)/%=%)




    LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes

cocos2d-x发生undefined reference to `XX'异常 一劳永逸解决的方法

标签:statistic   声明   one   dev   enc   styles   sid   link   file   

原文地址:https://www.cnblogs.com/mqxnongmin/p/10548363.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
分享档案
周排行
mamicode.com排行更多图片
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!