Errors at compilation

i have written this :

hvs = CreateShader(VERTEX_SHADER);

and my errors are :
error C2065: ‘CreateShader’ : undeclared identifier
error C2065: ‘VERTEX_SHADER’ : undeclared identifier

I have the latest drivers for my ATI card (it works perfectly with render monkey), i don’t understand because i have read this in the opengl 2.0 specs
can you help me ?

Try glCreateShader and GL_VERTEX_SHADER. And of course, make sure you have setup all function pointers and so on.
Personally, I never understood the point of excluding the GL_ and gl from all names and enums in the spec.

Try glCreateShader and GL_VERTEX_SHADER

You sure you have the latest headers and are using someting like GLee/Glew?

it works for GL_VERTEX_SHADER but not with glCreateShader. :frowning:
what do you mean by “setup all function pointers and so on” ?

about the headers, i just use glext.h

Anything above OpenGL 1.1 should be accessed with the extension loading mechanism. On Windows you don’t have a choice, and on Linux it is still better not to statically link to the functions.

On Windows the extension loading works like this:

glCreateShader = wglGetProcAddress("glCreateShader");

Be sure to check the version string for OpenGL 2.0 support before you do this.

Alternatively you could use glew or a similar extension loading library…

ok, thanks guys

Hi, you may also check out GLEW, It does a wonderful job of loading extensions.

Another possibility much better (I think) than the glGetProcAddress(…) and the glew library, is to use the static library of ATI (which work also for other vendor hardware, unless you use ATI extensions).
You can dowload them on the ATI web side (just downloading a “sample project”)

you have just to link
to your project

and write
#include “extsetup.h”
in your source

It is better than glGetProcAddress because it’s very painful to write this “linkage” section for each extensions.
In my opinion is also better than the glew because is released by an official OpenGL vendor and it is straightforward to use (of course you can think different).

At the Setup phase, in your source, you have just to write


or another version.
To load specific extensions:



ok thanks for your tips :smiley:

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