glCreateShader is crashing

There is another situation when this can happen and the conditions are far from obvious. If you decide to use glfw AND glew in your application, you can also end in glCreateShader() ACCESS_VIOLATION, if you wrote:

glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

If you change this line to

glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);

the ACCESS_VIOLATION due to the NULL function pointer glCreateShader() is gone.

Do not ask me, how the two libraries glew and glfw interfere with each other... voodoo alert!


You have to initialize GLEW before you can use it:

GLenum err = glewInit();