错误构建cocos2dx android

时间:2013-05-11 11:45:44

标签: android cocos2d-x

我在Windows 7上构建了cocos2d-x android项目。

$。 / Build_native.sh - 运行,进程落在

Compile++ thumb  : cocos2dx_static <= CCFileUtilsAndroid.cpp
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp: In  member function 'virtual bool cocos2d::CCFileUtilsAndroid::isFileExist(const string&)':
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:88:9: error: 'FILE' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:88:15: error: 'fp' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:88:50: error: 'fopen' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:92:22: error: 'fclose' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp: In member function 'virtual unsigned char* cocos2d::CCFileUtilsAndroid::getFileData(const char*, const char*, long unsigned int*)':
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:133:13: error: 'FILE' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:133:19: error: 'fp' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:133:50: error: 'fopen' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:137:32: error: 'fseek' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:138:28: error: 'ftell' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:141:62: error: 'fread' was not declared in this scope
D:/work/Android/rep/cocos2d-2.1rc0-x-2.1.3/testCocos2dx/proj.android/../../cocos2dx/platform/android/CCFileUtilsAndroid.cpp:142:22: error: 'fclose' was not declared in this scope
/cygdrive/d/work/Android/android-ndk-r8-crystax-1/build/core/build-binary.mk:320: recipe for target `obj/local/armeabi/objs/cocos2dx_static/platform/android/CCFileUtilsAndroid.o' failed

ScreenShot:http://joxi.ru/wy6OUdg5CbBkfuw7mZ4

如何修复它以构建项目?

2 个答案:

答案 0 :(得分:3)

似乎Cocos2d-x代码不包含声明这些内容的cstdio标头。要解决此问题,请编辑CCFileUtilsAndroid.cpp文件并添加行

#include <cstdio>

在顶部与其他包括。现在应该找到所有那些f *函数和FILE。

答案 1 :(得分:0)

你解决了这个问题吗? Arleryd的解决方案对我有用,你发布的后期错误可以通过以下方式解决:

将C:\ cocos2d-x-2.2.0 \ cocos2dx \ platform \ android导入eclipse,然后完成。看到这个:

http://www.cocos2d-x.org/wiki/How_to_set_up_the_android_cocos2d-x_development_environment_on_Windows_7