I imported gl.h and linked it in g++, but the compiler doesn 't recognize them.
Here is an error:
error: ‘glGetShaderInfoLog’ was not declared in this scope
Thanks
I imported gl.h and linked it in g++, but the compiler doesn 't recognize them.
Here is an error:
error: ‘glGetShaderInfoLog’ was not declared in this scope
Thanks
Which platform and OpenGL version?
On Linux, recent versions of the GL headers require you to define GL_GLEXT_PROTOTYPES
if you want prototypes for OpenGL 2+ functions. Otherwise, they only provide typedef
s for function pointers, e.g.
typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
You can either declare a variable of that type and use glXGetProcAddress
to obtain the pointer, or use a library such as GLEW to do it for you. If you use GLEW, then glew.h
will provide the appropriate macro definitions, e.g.
#define glGetShaderInfoLog GLEW_GET_FUN(__glewGetShaderInfoLog)
Note that defining GL_GLEXT_PROTOTYPES
will only work if libGL
exports the symbols (this is a compile-time option). Otherwise you have to use glXGetProcAddress
(directly or via a library such as GLEW).