NDK编译:fatal error: GLES2/gl2platform.h: No such file or directory

该问题是在编译一个cocos2d游戏出现的,问题详情:

D:\tmp3\arkaflow-android\arkaflowandroid\src\main\jni>ndk-build
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= main.cpp
In file included from D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/../../../../../cocos2d/cocos/3d/../platform/CCGL.h:37:0,
                 from D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/../../../../../cocos2d/cocos/3d/../base/ccTypes.h:36,
                 from D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/../../../../../cocos2d/cocos/3d/../base/CCProtocols.h:33,
                 from D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/../../../../../cocos2d/cocos/3d/../2d/CCNode.h:35,
                 from D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/../../../../../cocos2d/cocos/3d/../2d/CCScene.h:32,
                 from D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/../../../../../cocos2d/cocos/3d/../base/CCDirector.h:38,
                 from D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/../../../../../cocos2d/cocos/3d/../base/CCAsyncTaskPool.h:29,
                 from D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/../../../../../cocos2d/cocos/3d/../cocos2d.h:41,
                 from D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/../../Classes/AppDelegate.h:4,
                 from D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/hellocpp/main.cpp:1:
D:/tmp3/arkaflow-android/arkaflowandroid/src/main/jni/../../../../../cocos2d/cocos/3d/../platform/android/CCGL-android.h:44:31: fatal error: GLES2/gl2platform.h: No such file or directory
 #include 
                               ^
compilation terminated.
make.exe: *** [D:/tmp3/arkaflow-android/arkaflowandroid/src/main/obj/local/armeabi-v7a/objs/cocos2dcpp_shared/hellocpp/main.o] Error 1

该头文件在工具链目录下是存在的:下图

NDK编译:fatal error: GLES2/gl2platform.h: No such file or directory_第1张图片

这种问题大概有两种原因:

1.兼容性原因;

2.路径问题;


我这里的原因应该是未指明APP_PLATFORM,我重新在application.mk 中指明一个APP_PLATFORM := 9,然后再运行。

D:\tmp3\arkaflow-android\arkaflowandroid\src\main\jni>ndk-build
Android NDK: WARNING: APP_PLATFORM android-21 is larger than android:minSdkVersion 11 in D:/tmp3/arkaflow-android/arkaflowandroid/src/main/AndroidManifest.xml
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= main.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= stdafx.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= AppDelegate.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= EngineHelper.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= TitleBar.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= BallButton.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= EdgedBallButton.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= BallSlider.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= BallDialog.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= SmartString.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= Ring.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= Target.cpp
[armeabi-v7a] Compile++ thumb: cocos2dcpp_shared <= Brick.cpp
问题解决。


新增:

后面在编译cocos2dx引擎时,又碰到这个问题,该方法竟然解决不了,仍然是路径原因,查资料时发现看到一条大概说的是:

Windows路径不能太深,否则也会出现找不到路径。

我把项目重新提了出来,果然没问题了。


你可能感兴趣的:(Android,Android)