我通过cocos new test -p com.xxx.test -l cpp 创建新工程
修改Android.mk 由
LOCAL_SRC_FILES := hellocpp/main.cpp
…/…/…/Classes/AppDelegate.cpp
…/…/…/Classes/HelloWorldScene.cpp
修改为:
FILE_LIST := hellocpp/main.cppFILE_LIST += (wildcard (LOCAL_PATH)/…/…/Classes/.cpp)LOCAL_SRC_FILES := (FILE_LIST:(LOCAL_PATH)/=)*
别的没改, 然后使用cocos compile -p android --android-studio 打包项目,结果出现错误:
jni/hellocpp/main.cpp
error: undefined reference to 'AppDelegate::AppDelegate()‘collect2: error: ld returned 1 exit statusmake: *** Error 1make: Leaving directory `/Users/xiaoz/proj/tfontatlas/proj.android-studio/app’
把android.mk改回来后又能正确编译了。难道–android-studio 项目不支持wildcard?如果文件多了怎么办?
文件多了,以前我们是自己写几行代码,然后自动添加头文件。