因?yàn)榍岸螘r(shí)間都在用quick,所以對(duì)C++這邊又感覺陌生。最近在寫項(xiàng)目,用C++的,編譯的時(shí)候遇見蛋疼的問題,也怪我缺乏經(jīng)驗(yàn)。。。
在汕城等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè) 網(wǎng)站設(shè)計(jì)制作定制開發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),全網(wǎng)營(yíng)銷推廣,成都外貿(mào)網(wǎng)站建設(shè)公司,汕城網(wǎng)站建設(shè)費(fèi)用合理。
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := cocos2dcpp_shared LOCAL_MODULE_FILENAME := libcocos2dcpp #遍歷目錄及子目錄的函數(shù) define walk $(wildcard $(1)) $(foreach e, $(wildcard $(1)/*), $(call walk, $(e))) endef # 遍歷Classes目錄 ALLFILES = $(call walk, $(LOCAL_PATH)/../../Classes) FILE_LIST := hellocpp/main.cpp # 從所有文件中提取出所有.cpp文件 FILE_LIST += $(filter %.cpp, $(ALLFILES)) 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 += cocos_extension_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static include $(BUILD_SHARED_LIBRARY) $(call import-module,2d) $(call import-module,audio/android) $(call import-module,Box2D) $(call import-module,network) $(call import-module,extensions)
這是以前項(xiàng)目的android.mk文件,我直接拷貝過來用。。。編譯的時(shí)候發(fā)現(xiàn)如下錯(cuò)誤
然后直接亂寫,把以上$(call import-module,2d)類似的代碼都刪除,就保留一個(gè)$(call import-module,.),試著編譯,竟然成功了?。。。。。『瞄_心。。。
但在導(dǎo)入到eclipse的時(shí)候,報(bào)錯(cuò)看不懂。。。。
最終發(fā)現(xiàn)原來是版本問題,我拷貝的android.mk是3.0的。。。。我現(xiàn)在開發(fā)是3.3.。。兩者的區(qū)別是$(call import-module,2d)改成了$(call import-module,.),其他不變,但是LOCAL_WHOLE_STATIC_LIBRARIES增加了什么,$(call import-module,xxx)相應(yīng)的模塊。
這次真的長(zhǎng)知識(shí)了~
最終的android.mk文件如下:
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) $(call import-add-path,$(LOCAL_PATH)/../../cocos2d) $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external) $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos) LOCAL_MODULE := cocos2dcpp_shared LOCAL_MODULE_FILENAME := libcocos2dcpp #遍歷目錄及子目錄的函數(shù) define walk $(wildcard $(1)) $(foreach e, $(wildcard $(1)/*), $(call walk, $(e))) endef # 遍歷Classes目錄 ALLFILES = $(call walk, $(LOCAL_PATH)/../../Classes) FILE_LIST := hellocpp/main.cpp\ # 從所有文件中提取出所有.cpp文件 FILE_LIST += $(filter %.cpp, $(ALLFILES)) LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes LOCAL_STATIC_LIBRARIES := cocos2dx_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static include $(BUILD_SHARED_LIBRARY) $(call import-module,.) $(call import-module,network) $(call import-module,extensions)