glCreateShader include directory?

I want to create a GLSL shader program, but my compiler says it cant find the function glCreateShader(), what file do i need to include for this function and other glsl shader functions?

Have you checked your gl.h file?
Do you maintain this yourself or do you use someone elses?

You need an OpenGL extension loading library to use them. Or you could write one yourself.

Thanks, I downloaded and installed GLEW and included the header. Now I get unresolved external linker errors. I’ve checked the gl.h file and it doesn’t contain a glCreateShader function.

Of course it doesn’t. When you use GLEW, you use glew.h, not gl.h. Did you read the directions?

Ok, sorry, I skimmed through the directions. I’m now only including glew.h and I’m still getting linker errors.

EDIT:
Actually I’ve just realised they are different.
Here is one.

unresolved external symbol __imp____glewUseProgram

I have got the GLEW dll in the system32 folder, the lib file in VC++'s lib folder, and the glew.h and wglew.h in the VC++'s include folder.

Did you actually link to the library? You know, have it listed in the “Linker/Input/Additional Dependencies” list of libraries to link with.

And it’s generally bad form to fling .dlls into the system folder and .libs into Visual Studio’s directories.

Of course! I forgot to link the lib files. Anyway I was following the instructions on the site which are obviously for older versions of VC++. Anyway I’ve now sorted put all of the lib files and headers in a seperate folder, edited the project’s “VC++ Directories” in it’s settings, put the dll in the working directory, and linked to the lib files. There are no more errors. Thanks.

EDIT:
Nope sorry, I’m getting a runtime error saying no more than…
“Unhandled exception at 0x00000000 in Upgraded Engine.exe: 0xC0000005: Access violation.”
This occurs when i use glCreateShader(GL_VERTEX_SHADER);

Forget about the runtime errors i fixed them. However the shader itself is just simply not doing anything, im still getting per vertex shading.

Nevermind again, it was faulty glsl, everything works now :smiley:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.