我正在尝试按照本指南为 android 构建和运行测试项目:
"http://www.cocos2d-x.org/wiki/Setting_up_Android_Development_Environment_on_Mac_OSX#Get-the-NDK "
具体问题是在 eclipse 中构建名为“TestCpp”的测试演示之后 它有另一个链接到它的项目“libcocos2dx”我收到一条错误消息:
make: *** [obj/local/armeabi/objs/cocos_extension_static/CocoStudio/Reader/WidgetReader/LabelReader/LabelReader.o] 错误1
这是控制台在构建过程中显示的内容:
**** 项目 TestCpp 的默认配置构建 ****
bash/Users/mohammadbaroudi/Downloads/cocos2d-x-2.2.5/samples/Cpp/TestCpp/proj.android/build_native.sh
NDK_ROOT =/Users/mohammadbaroudi/下载/android-ndk-r10
COCOS2DX_ROOT =/Users/mohammadbaroudi/Downloads/cocos2d-x-2.2.5/samples/Cpp/TestCpp/proj.android/../../../..
APP_ROOT =/Users/mohammadbaroudi/Downloads/cocos2d-x-2.2.5/samples/Cpp/TestCpp/proj.android/..
APP_ANDROID_ROOT =/Users/mohammadbaroudi/Downloads/cocos2d-x-2.2.5/samples/Cpp/TestCpp/proj.android
使用预建的外部
Android NDK:警告:/Users/mohammadbaroudi/Downloads/cocos2d-x-2.2.5/samples/Cpp/TestCpp/proj.android/../../../../cocos2dx/Android.mk:cocos2dx_static: LOCAL_LDLIBS 对于静态库总是被忽略
make:进入目录/Users/mohammadbaroudi/Downloads/cocos2d-x-2.2.5/samples/Cpp/TestCpp/proj.android'
[armeabi] Compile++ thumb: cocos_extension_static <= LabelReader.cpp
/Users/mohammadbaroudi/Downloads/cocos2d-x-2.2.5/samples/Cpp/TestCpp/proj.android/../../../../extensions/CocoStudio/Reader/WidgetReader/LabelReader/LabelReader.cpp: In member function 'virtual void cocos2d::extension::LabelReader::setPropsFromJsonDictionary(cocos2d::ui::Widget*, const Value&)':
/Users/mohammadbaroudi/Downloads/cocos2d-x-2.2.5/samples/Cpp/TestCpp/proj.android/../../../../extensions/CocoStudio/Reader/WidgetReader/LabelReader/LabelReader.cpp:54:9: error: 'transform' is not a member of 'std'
std::transform(file_extension.begin(),file_extension.end(), file_extension.begin(), (int(*)(int))toupper);
^
make: *** [obj/local/armeabi/objs/cocos_extension_static/CocoStudio/Reader/WidgetReader/LabelReader/LabelReader.o] Error 1
make: Leaving directory
/Users/mohammadbaroudi/Downloads/cocos2d-x-2.2.5/samples/Cpp/TestCpp/proj.android'
**** 构建完成 ****
现在我查看文件路径,它指向一个不存在的obj文件“LabelReader.o”,奇怪的是在“上面错误中提到的”“/WidgetReader”文件夹中,有多个阅读器文件夹例如:“ButtonReader、CheckBoxReader 等”都带有同名的“.o”和“.o.d”文件,但 LabelReader 文件夹是空的。
我试图通过右键单击 eclipse 中的文件并排除它来从构建过程中排除“LabelReader.o”文件,但是发生了同样的错误,我试图右键单击问题选项卡中的错误并点击“fix”通知我它无法修复它。最后想到的是通过修改 makefile 本身从编译中排除“LabelReader.o”文件,在这里讨论:
Makefile. How to exclude one particular file from compilation?
但似乎有多种方法可以做到这一点,但我仍然不确定我是否完全理解出了什么问题,只是缺少一个正在编译但无法构建的文件。如果这个问题太过分,我很抱歉很大,这也是我在这里的第一个问题,如果我写了很多,请原谅。
最佳答案
在发生错误的文件中添加这一行
#include <algorithm>
关于android - 构建testcpp Eclipse项目后报错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24848923/