当我尝试在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
我不知道为什么会出现这种类型的错误。
有人可以帮我解决这个问题吗?
答案 0 :(得分:1)
上述评论中确定的答案:
编译器找不到GLES / gl.h。如果您只添加了一个链接器指令,则可能需要告诉编译器这些头文件的位置。
建议您按照此答案中的建议:stackoverflow.com/a/5300984/440602