Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'glCreateShader' was not declared in this scope?

Why am I getting these errors?

error: 'GL_VERTEX_SHADER' was not declared in this scope
error: 'glCreateShader' was not declared in this scope

Code:

GLuint vs = glCreateShader(GL_VERTEX_SHADER);

And yes, I do have the includes to glut.

like image 541
Daniel says Reinstate Monica Avatar asked Aug 15 '12 00:08

Daniel says Reinstate Monica


1 Answers

What does glGetString(GL_VERSION) return?

CreateShader is not in GLUT but OpenGL 2.0. If your "includes to glut" are not including gl.h for some reason or your GL version is less than 2.0, the headers will not declare it.

I'd also check your gl.h to see if CreateShader is actually declared there.

Edit: This OpenGL header version thing seems to be a general problem in Windows. Most people suggest using GLEW or another extension loader library to get around it.

like image 126
aib Avatar answered Oct 12 '22 06:10

aib