Cocos2d-x 自动在Android.mk文件中手动添加cpp文件 - Inzaghi-iOS开发博客,互联网资讯,米兰新闻

Cocos2d-x 自动在Android.mk文件中手动添加cpp文件

 

将Android.mk的内容替换成以下内容即可:

# —————————————Start

LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE := hellocpp_shared

LOCAL_MODULE_FILENAME := libhellocpp

FILE_LIST := hellocpp/main.cpp
FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*.cpp)
LOCAL_SRC_FILES := $(FILE_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)

# —————————————End

 

可以解决编译时出现的这种错误:
使用bulid_native.sh编译为android工程,
[armeabi] SharedLibrary  : libcocos2dcpp.so
/Users/YiJiang/ly/cocos2dx/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/LoginScene.o: in function Toast::create():jni/../../Classes/Toast.h:22: error: undefined reference to ‘Toast::Toast()’
 

标签:
,
分类:iOS开发 | 发布:inzaghi | 评论:0 条 | 发表时间:2014-12-28 14:43
引用:点击这里获取该日志的TrackBack引用地址
上一篇:
下一篇:

发表评论

*

* 绝不会泄露


Design By Inzaghi | 京ICP备16047555号-1