Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/223.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/130.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Cocos2d-x移植到Android的问题_Android_C++ - Fatal编程技术网

将Cocos2d-x移植到Android的问题

将Cocos2d-x移植到Android的问题,android,c++,Android,C++,我已经用Cocos2D-x编写了一个基本游戏。它在iPhone上运行良好。现在我正在尝试将其移植到Android。当我运行脚本时,它给出以下错误: jni/../../Classes/MemoryModeLayer.cpp: In member function 'void MemoryModeLayer::startNewGame()': jni/../../Classes/MemoryModeLayer.cpp:109:25: error: 'time' is not a member of

我已经用
Cocos2D-x
编写了一个基本游戏。它在iPhone上运行良好。现在我正在尝试将其移植到Android。当我运行脚本时,它给出以下错误:

jni/../../Classes/MemoryModeLayer.cpp: In member function 'void MemoryModeLayer::startNewGame()':
jni/../../Classes/MemoryModeLayer.cpp:109:25: error: 'time' is not a member of 'std'
jni/../../Classes/MemoryModeLayer.cpp:109:25: note: suggested alternative:
/Users/abc/android-ndk-r9d/platforms/android-8/arch-arm/usr/include/time.h:40:17: note:   'time'
jni/../../Classes/MemoryModeLayer.cpp:111:5: error: 'random_shuffle' is not a member of 'std'
jni/../../Classes/MemoryModeLayer.cpp:112:5: error: 'random_shuffle' is not a member of 'std'
make: *** [obj/local/armeabi/objs/cocos2dcpp_shared/__/__/Classes/MemoryModeLayer.o] Error 1
make: Leaving directory `/Users/anil/cocos2d-x-2.2.3/projects/Game/proj.android'
在MemoryModeLayer.cpp中,我有以下内容:

std::srand(unsigned(std::time(0)));
std::random_shuffle(_xCod, _xCod + _numberOfRows);
std::random_shuffle(_yCod, _yCod + _numberOfColumns);
我还包括以下标题:

#include <string>
#include <ctime>
#include <algorithm> 
#include <iostream>
#include <iomanip>
#包括
#包括
#包括
#包括
#包括

还使用命名空间std在头文件中添加了
。还有什么我应该做的吗?

您需要
#包括
Application.mk文件有问题。必须更改STL库查找,如下所示:

APP\u STL:=stlport\u static
添加到Application.mk文件中。它可能已经有
APP\u STL:=gnustl\u static

下面的博文很有帮助


我找不到random.h。上面写着random.h没有找到。