微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Android NDK错误使用未声明的标识符Opengl-ES

如何解决Android NDK错误使用未声明的标识符Opengl-ES

我正在尝试使用Cmake和NDK从Android Studio上的C ++源文件构建一个共享库。我经历了很多错误和很多困难。当我尝试构建项目时,我遇到的最新错误是:

Execution Failed for task ':mobile:generateJsonModelDebug'.
exception while building Json $C:\Users\User\Documents\B3d\mobile\.cxx\cmake\debug\armeabi-v7a\compile_commands.json (The system cannot find the file specified)

Android Studio,Gradle插件和cmake都是最新的。有什么问题吗?

我尝试使用cmd而不是Android Studio进行编译,但出现此错误

jni/texture.h:15:10: Fatal error: 'list' file not found

在texture.h文件中,有#include <list>

所以我将Application.mk文件添加到包含以下内容的源文件文件夹中

APP_ABI := armeabi-v7a
APP_CPPFLAGS += -std=c++11
APP_STL := c++_shared
APP_CPPFLAGS += -frtti

错误消失了,并显示了一组新的错误

jni/project.h:50:1: error: unkNown type name 'GLint'
error: unkNown type name 'GLfloat'; did you mean 'float'?

我认为这与OpenGL有关,因此我在该文件中包含#include 而下一组错误是:

error: use of undeclared identifier 'glFrustum'
error: use of undeclared identifier 'glOrtho'
error: use of undeclared identifier 'GL_FOG'

还有其他一些;可能有什么问题,我使用了#include <GLES2/gl2.h>

好的,我已经看到了问题。这些标识符在OpenGL-ES中不可用。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。