need help with glew

I’m trying to use glew so that I can write to framebuffers. Even though I include glew.h, trying to use glew functions causes an error.
important parts of code:

#include <GL\glew.h>
#include <GL\glut.h>
#include <Cg\cgGL.h>

#pragma comment(lib, “glew32.lib”)
#pragma comment(lib, “cg.lib”)
#pragma comment(lib, “cggl.lib”)

int err = glewInit(); // works fine
if (GLEW_OK != err) exit(-1);

GLuint fb;
glGenFramebuffersEXT(1, &fb); // causes error

can anyone help me?

WHAT error ? compile ? link ? run ? … ? with which message ?

When I try to run it, a message pops up saying that it encountered a problem and needs to close.

What happens exactly? Could be drivers, could be the version of glew you’re using.

You should also probably link to opengl32.lib glut32.lib and possible glu32.lib for good practice.

I using the latest version of glew available on the website…
What happens is a window pops up saying there was an error (the same window that appears with Internet Explorer sometimes)

also when i do this:

glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress(“glTexImage3D”);
glGenFramebuffersEXT = (PFNGLGENFRAMEBUFFERSEXTPROC) wglGetProcAddress(“glGenFramebuffersEXT”);

the top function will work fine but the bottom function still gets the same error.

What happens is a window pops up saying there was an error (the same window that appears with Internet Explorer sometimes)
Sorry but you really made me laugh, try using a real browser instead.

Back to the topic, run your prog with a debugger, and post the exact message.

GLEW has been know to leave some functions uninitialized. Check that the function pointer for glGenFramebuffersEXT is actually being initialized and that the extension is present. If the call to get the proc address is giving you NULL, then the extension isn’t present. You can also check the extension string yourself, or use the GLEW macros to check for the extension.

One other thing to consider is that windows returns a function pointer that is specific to the context that was current at the time of the call. If you are calling this method from another context, it could cause problems. Function entry points for windows cannot be assumed to work across contexts.