错误:GLES/gl.h:没有这样的文件或目录

发布于 2024-12-27 10:56:44 字数 6215 浏览 3 评论 0原文

当我尝试在 JNI 中使用 OpenGL 时,出现以下错误

Compile++ thumb  : itv <= native.cpp
C:/workspace/InternetTV_OpenGL/jni/native.cpp:1:50: warning: extra tokens at end
 of #include directive
C:/workspace/InternetTV_OpenGL/jni/native.cpp:3:21: error: GLES/gl.h: No such fi
le or directory
C:/workspace/InternetTV_OpenGL/jni/native.cpp:4:24: error: GLES/glext.h: No such
 file or directory
C:/workspace/InternetTV_OpenGL/jni/native.cpp:15:1: warning: "No_Threads" redefi
ned
In file included from C:/workspace/InternetTV_OpenGL/jni/native.cpp:9:
C:/workspace/InternetTV_OpenGL/jni/internetTV/MPEG2_REF_OPT/global.h:32:1: warni
ng: this is the location of the previous definition
In file included from C:/workspace/InternetTV_OpenGL/jni/native.cpp:1:
C:/workspace/InternetTV_OpenGL/jni/internetTV_openGL_VideoGLSurfaceView.h:48: er
ror: 'CALLBACK_FN_RENDER_VIDEO' has not been declared
C:/workspace/InternetTV_OpenGL/jni/internetTV_openGL_VideoGLSurfaceView.h:51: er
ror: 'CALLBACK_FN_RENDER_VIDEO' has not been declared
C:/workspace/InternetTV_OpenGL/jni/native.cpp:23: error: 'GLuint' does not name
a type
C:/workspace/InternetTV_OpenGL/jni/native.cpp:24: error: 'GLuint' does not name
a type
C:/workspace/InternetTV_OpenGL/jni/native.cpp:34: error: 'GLfloat' does not name
 a type
C:/workspace/InternetTV_OpenGL/jni/native.cpp:48: error: 'GLfloat' does not name
 a type
C:/workspace/InternetTV_OpenGL/jni/native.cpp: In function 'void Java_internetTV
_openGL_VideoGLSurfaceView_native_1gl_1render(JNIEnv*, _jobject*)':
C:/workspace/InternetTV_OpenGL/jni/native.cpp:91: error: 'GL_COLOR_BUFFER_BIT' w
as not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:91: error: 'GL_DEPTH_BUFFER_BIT' w
as not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:91: error: 'glClear' was not decla
red in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:92: error: 'GL_MODELVIEW' was not
declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:92: error: 'glMatrixMode' was not
declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:93: error: 'glLoadIdentity' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:95: error: 'GL_VERTEX_ARRAY' was n
ot declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:95: error: 'glEnableClientState' w
as not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:96: error: 'GL_TEXTURE_COORD_ARRAY
' was not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:97: error: 'GL_FLOAT' was not decl
ared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:97: error: 'vertices' was not decl
ared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:97: error: 'glVertexPointer' was n
ot declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:98: error: 'texCoords' was not dec
lared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:98: error: 'glTexCoordPointer' was
 not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:99: error: 'GL_TRIANGLE_STRIP' was
 not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:99: error: 'glDrawArrays' was not
declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:100: error: 'GL_DEPTH_TEST' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:100: error: 'glDisable' was not de
clared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:104: error: 'glDisableClientState'
 was not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp: In function 'void grabFrame()':
C:/workspace/InternetTV_OpenGL/jni/native.cpp:125: error: 'GL_TEXTURE_2D' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:125: error: 'GL_RGBA' was not decl
ared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:125: error: 'GL_UNSIGNED_BYTE' was
 not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:125: error: 'glTexImage2D' was not
 declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp: In function 'void Java_kieran_ple
asework_VideoGLSurfaceView_native_1init(JNIEnv*, _jobject*, _jstring*)':
C:/workspace/InternetTV_OpenGL/jni/native.cpp:132: error: 'GL_TEXTURE_2D' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:132: error: 'glEnable' was not dec
lared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:133: error: 'GL_BLEND' was not dec
lared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:133: error: 'glDisable' was not de
clared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:136: error: 'textureId' was not de
clared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:136: error: 'glGenTextures' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:137: error: 'i' was not declared i
n this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:140: error: 'glBindTexture' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:143: error: 'GL_TEXTURE_MIN_FILTER
' was not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:143: error: 'GL_LINEAR' was not de
clared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:143: error: 'glTexParameteri' was
not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:144: error: 'GL_TEXTURE_MAG_FILTER
' was not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:145: error: 'GL_TEXTURE_WRAP_S' wa
s not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:145: error: 'GL_CLAMP_TO_EDGE' was
 not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:146: error: 'GL_TEXTURE_WRAP_T' wa
s not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:180: error: cannot convert 'void (
*)(unsigned char*, long unsigned int, unsigned int, unsigned int, unsigned int)'
 to 'int*' for argument '2' to 'int main_dec(char*, int*)'
make: *** [/cygdrive/c/workspace/InternetTV_OpenGL/obj/local/armeabi/objs/itv/na
tive.o] Error 1

我还在 Android.mk 文件中添加了 LOCAL_LDLIBS := -llog -lGLESv1_CM 我不知道为什么会出现这种类型的错误。 有人可以帮我解决这个问题吗?

I am getting this the following error when I am trying to use OpenGL in JNI

Compile++ thumb  : itv <= native.cpp
C:/workspace/InternetTV_OpenGL/jni/native.cpp:1:50: warning: extra tokens at end
 of #include directive
C:/workspace/InternetTV_OpenGL/jni/native.cpp:3:21: error: GLES/gl.h: No such fi
le or directory
C:/workspace/InternetTV_OpenGL/jni/native.cpp:4:24: error: GLES/glext.h: No such
 file or directory
C:/workspace/InternetTV_OpenGL/jni/native.cpp:15:1: warning: "No_Threads" redefi
ned
In file included from C:/workspace/InternetTV_OpenGL/jni/native.cpp:9:
C:/workspace/InternetTV_OpenGL/jni/internetTV/MPEG2_REF_OPT/global.h:32:1: warni
ng: this is the location of the previous definition
In file included from C:/workspace/InternetTV_OpenGL/jni/native.cpp:1:
C:/workspace/InternetTV_OpenGL/jni/internetTV_openGL_VideoGLSurfaceView.h:48: er
ror: 'CALLBACK_FN_RENDER_VIDEO' has not been declared
C:/workspace/InternetTV_OpenGL/jni/internetTV_openGL_VideoGLSurfaceView.h:51: er
ror: 'CALLBACK_FN_RENDER_VIDEO' has not been declared
C:/workspace/InternetTV_OpenGL/jni/native.cpp:23: error: 'GLuint' does not name
a type
C:/workspace/InternetTV_OpenGL/jni/native.cpp:24: error: 'GLuint' does not name
a type
C:/workspace/InternetTV_OpenGL/jni/native.cpp:34: error: 'GLfloat' does not name
 a type
C:/workspace/InternetTV_OpenGL/jni/native.cpp:48: error: 'GLfloat' does not name
 a type
C:/workspace/InternetTV_OpenGL/jni/native.cpp: In function 'void Java_internetTV
_openGL_VideoGLSurfaceView_native_1gl_1render(JNIEnv*, _jobject*)':
C:/workspace/InternetTV_OpenGL/jni/native.cpp:91: error: 'GL_COLOR_BUFFER_BIT' w
as not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:91: error: 'GL_DEPTH_BUFFER_BIT' w
as not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:91: error: 'glClear' was not decla
red in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:92: error: 'GL_MODELVIEW' was not
declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:92: error: 'glMatrixMode' was not
declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:93: error: 'glLoadIdentity' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:95: error: 'GL_VERTEX_ARRAY' was n
ot declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:95: error: 'glEnableClientState' w
as not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:96: error: 'GL_TEXTURE_COORD_ARRAY
' was not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:97: error: 'GL_FLOAT' was not decl
ared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:97: error: 'vertices' was not decl
ared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:97: error: 'glVertexPointer' was n
ot declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:98: error: 'texCoords' was not dec
lared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:98: error: 'glTexCoordPointer' was
 not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:99: error: 'GL_TRIANGLE_STRIP' was
 not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:99: error: 'glDrawArrays' was not
declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:100: error: 'GL_DEPTH_TEST' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:100: error: 'glDisable' was not de
clared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:104: error: 'glDisableClientState'
 was not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp: In function 'void grabFrame()':
C:/workspace/InternetTV_OpenGL/jni/native.cpp:125: error: 'GL_TEXTURE_2D' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:125: error: 'GL_RGBA' was not decl
ared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:125: error: 'GL_UNSIGNED_BYTE' was
 not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:125: error: 'glTexImage2D' was not
 declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp: In function 'void Java_kieran_ple
asework_VideoGLSurfaceView_native_1init(JNIEnv*, _jobject*, _jstring*)':
C:/workspace/InternetTV_OpenGL/jni/native.cpp:132: error: 'GL_TEXTURE_2D' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:132: error: 'glEnable' was not dec
lared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:133: error: 'GL_BLEND' was not dec
lared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:133: error: 'glDisable' was not de
clared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:136: error: 'textureId' was not de
clared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:136: error: 'glGenTextures' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:137: error: 'i' was not declared i
n this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:140: error: 'glBindTexture' was no
t declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:143: error: 'GL_TEXTURE_MIN_FILTER
' was not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:143: error: 'GL_LINEAR' was not de
clared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:143: error: 'glTexParameteri' was
not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:144: error: 'GL_TEXTURE_MAG_FILTER
' was not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:145: error: 'GL_TEXTURE_WRAP_S' wa
s not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:145: error: 'GL_CLAMP_TO_EDGE' was
 not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:146: error: 'GL_TEXTURE_WRAP_T' wa
s not declared in this scope
C:/workspace/InternetTV_OpenGL/jni/native.cpp:180: error: cannot convert 'void (
*)(unsigned char*, long unsigned int, unsigned int, unsigned int, unsigned int)'
 to 'int*' for argument '2' to 'int main_dec(char*, int*)'
make: *** [/cygdrive/c/workspace/InternetTV_OpenGL/obj/local/armeabi/objs/itv/na
tive.o] Error 1

I have also added LOCAL_LDLIBS := -llog -lGLESv1_CM in Android.mk file
I don’t know why such type of error is coming.
Can anybody please help me to solve this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光匆匆的小流年 2025-01-03 10:56:44

上面问题注释中确定的答案:

编译器找不到 GLES/gl.h。如果您只添加了链接器指令,您可能还需要告诉编译器这些标头的位置。

建议您遵循此答案中的建议:stackoverflow.com/a/5300984/440602

Answer determined in question comments above:

The compiler can't find GLES/gl.h. If you've only added a linker directive, you probably need to tell the compiler where those headers are too.

Suggest you follow the advice in this answer: stackoverflow.com/a/5300984/440602

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文