PDA

View Full Version : Adding glew library



Cucus
20th June 2011, 01:28
Hi,

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
TEMPLATE = app


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 \
matrixcalculator.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 \
tree.hh

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 (http://glew.sourceforge.net/install.html) but nothing. I have put the header <GL/glew.h> in the right place but stills not working.
Any idea?

ChrisW67
20th June 2011, 05:46
If the glew library binary is not on the standard linker search path then you also need to add its directory to the LIBS:


# Windows
LIBS += -L/path/to/glew/lib -lglew32 -lglu32 -lopengl
# Linux
LIBS += -L/path/to/glew/lib -lGLEW -lGLU -lGL

For GLEW installed into:


/path/to/glew/lib/libGLEW.so
or
/path/to/glew/lib/glew.lib

Cucus
20th June 2011, 15:52
Still not working:

I post here more information about the links to libraries:

This is the message before the error
mingw32-make[1]: Entering directory `C:/Documents and Settings/anubiola/Desktop/RoKiSim/test/Teste-build-desktop'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\Teste.exe object_script.Teste.Debug -L"c:\QtSDK\Desktop\Qt\4.7.3\mingw\lib" -lglu32 -lopengl32 -lgdi32 -luser32 -lmingw32 -lqtmaind -lglew32 -lQtWebKitd4 -lQtOpenGLd4 -lQtGuid4 -lQtCored4 -LC:\OpenSSL-Win32_full\lib

As you can see glew32 is linked.

ChrisW67
20th June 2011, 23:44
As you can see glew32 is linked.
No, your error message tells you exactly the opposite. You have not linked one or more of those libraries. I can see you have told the linker to use library glu32/glew32 if it can find them but that is clear that they are not found. The -L option I told you about adds to the search path the linker uses to find these libraries.