即使对于样本cocos2d helloworld文件,也会出现一些错误。
Android NDK: android-13 is unsupported. Using minimum supported version android-14.
[armeabi] Compile++ thumb: cocos2dxandroid_static <= ProcessCpuTracker.cpp
/home/user/Documents/cocos2d-x-3.15.1/game/cocos2d/cocos/platform/android/jni/ProcessCpuTracker.cpp: In function 'std::vector<_CpuInfo> readProcStat()':
/home/user/Documents/cocos2d-x-3.15.1/game/cocos2d/cocos/platform/android/jni/ProcessCpuTracker.cpp:69:54: error: 'read' was not declared in this scope
const int len = read(fd, buffer, sizeof(buffer)-1);
^
/home/user/Documents/cocos2d-x-3.15.1/game/cocos2d/cocos/platform/android/jni/ProcessCpuTracker.cpp:70:13: error: 'close' was not declared in this scope
close(fd);
怎么解决?
最佳答案
在APP_PLATFORM := android-14
文件中添加Application.mk
如果您没有该行,则从project.properties
文件获取SDK的版本。
NDK v15的#include <unistd.h>
文件中缺少ProcessCpuTracker.cpp
header
查看this答案以获取更多详细信息。