转载:
http://blog.csdn.net/gf771115/article/details/34414449
cocos2d-x发生undefined reference to `XX'错误 一劳永逸解决方法
原因是androID的nkd编译需要将每个cpp尽心进行声明进入jni目录下的Android.mk
将:
LOCAL_SRC_fileS := AppDelegate.cpp \
HelloWorldScene.cpp
修改为:
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)
//这个是新增的tIDy目录
MY_CPP_List += $(wildcard $(LOCAL_PATH)/../../Classes/tIDy/*.c)
LOCAL_SRC_fileS := $(MY_CPP_List:$(LOCAL_PATH)/%=%)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
--------
下面是一个Android.mk例子:
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODulE := cocos2dcpp_shared 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 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 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)
总结以上是内存溢出为你收集整理的cocos2d-x发生undefined reference to `XX'异常 一劳永逸解决办法全部内容,希望文章能够帮你解决cocos2d-x发生undefined reference to `XX'异常 一劳永逸解决办法所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)