Linking glew


I’m trying to add glew library on my project Qt but I don’t understand why, it didn’t find some functions.

Here’s my .pro:

# Project created by QtCreator 2011-03-22T23:49:11

QT       += core gui opengl
QT       += webkit

TARGET = Teste

SOURCES += main.cpp\
        menuprincipal.cpp \
    glwidget.cpp \
    box.cpp \
    point.cpp \
    arraylist.cpp \
    arraylist.operators.cpp \
    xml.cpp \
    tinyxmlparser.cpp \
    tinyxmlerror.cpp \
    tinyxml.cpp \
    tinystr.cpp \
    robot.cpp \
    joint.cpp \
    vertex.cpp \
    properties.cpp \
    face.cpp \

HEADERS  += menuprincipal.h \
    glwidget.h \
    box.h \
    point.h \
    arraylist.h \
    xml.h \
    tinyxml.h \
    tinystr.h \
    robot.h \
    joint.h \
    vertex.h \
    properties.h \
    face.h \
    matrixcalculator.h \

FORMS    += menuprincipal.ui
LIBS     += -lglew32

I don’t have problems calling code = glewInit(); but when I try to call other functions like glGenVertexArrays, I have this error:
undefined reference to `_imp____glewGenVertexArrays’

I read the instructions of how to set this library here but nothing. I have put the header <GL/glew.h> in the right place but stills not working.
Any idea?

When you program links successfully and runs there shouldnt be a problem with the installation of the lib.

What does glewinit return? Does it return GLEW_OK?
Are you sure that your OpenGL version support glGenVertexArrays? Read here how to check for this:
Glew Basic Usage

Also remember to install a proper OpenGL supporting graphics driver.

It returns 0, is the right value true?

I update my drivers yesterday

0 should equal GLEW_OK, so it seems ok.
However, you should check if your OpenGL version is at least 3.0 and that GLEW supports the command glGenVertexArrays as described in the link i gave you.

What other gl-commands do not work?

What hardware/system are you on?

With glewIsSupported(…) I check the version, I’m on openGL 3.3 (weird because as I said, I update yesterday :S)

Others call that don’t work:
and the constant “GLEW_VERSION_3_3”

This is all that I tryied for the moment.

System: Windows XP
NVIDIA Quadro FX1700 (version of driver: 6.14.0012.7536)
Intel 2Quad Q9300

If I understand what you’re trying to say, I need to put glewExperimental=TRUE; on my code?

Still not working.

Did you try one of the examples?,_VAO,VBO,shaders(C%2B%2B/_freeGLUT)

And if that doesn’t work, try getting the function pointers yourself.
You can then trace into the GLEW code to see why it fails.

V-man is right, you should check if you can retrieve the OpenGL function pointers for the non-working functions directly from windows using wglGetProcAdress… see here .

Also, since your graphics card is not a standard consumer model, you might to try to compile the code on another machine to ensure your code is fine.

The problem is solved, it was the graphic card. Now I m on another nVidia graphic card (more comercial) but I have another problem, check this post