错误:GLES/gl.h:没有这样的文件或目录
当我尝试在 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
上面问题注释中确定的答案:
编译器找不到 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