Hey,
Trying to get GLEW into Qt Creator and it's not working out well for me. I see there has been other threads posted about this issue, but I can't find one that has the answer.
Using: Qt Creator 2.0.1 with QT 4.7 (32) - attempting to use built-in OpenGL (2.1.2 according to OpenGL's GetString() functionality.
Trying to get GLEW in there, dl'ed "glew-1.7.0-win32" - put the .lib files in minGW/lib, the header files in minGW/include/GL, and the binaries/dll's in minGW/bin.
I am calling "glewInit();" after I establish an OpenGL context (should be after) but it's not even compiling. It has no trouble there, it has trouble when I try to use the function: "glGenBuffers((GLsizei)1, &a);" - this is part of the GLEW lib.
I modified my .pro file to have the following:
LIBS += -lglew32 -LC:\Qt\2010.05\mingw\lib\glew32.lib
QT += core gui opengl
INCLUDEPATH += C:\Qt\2010.05\mingw\include\GL
LIBS += -lglew32 -LC:\Qt\2010.05\mingw\lib\glew32.lib
QT += core gui opengl
INCLUDEPATH += C:\Qt\2010.05\mingw\include\GL
To copy to clipboard, switch view to plain text mode
This makes it so that it does NOT error when it attempts to file glew32, so it *should* be linking correctly, if I change that to something like '-lGLEW' I get an error that it can't find the lib. Though if I remove the path to the actual library so it is simply:
LIBS += -lglew32
QT += core gui opengl
INCLUDEPATH += C:\Qt\2010.05\mingw\include\GL
LIBS += -lglew32
QT += core gui opengl
INCLUDEPATH += C:\Qt\2010.05\mingw\include\GL
To copy to clipboard, switch view to plain text mode
It has the same error. Tried everything I can think of and everything I've found, error is always:
debug/cube.o: In function `DrawCube':
<project_path>/cube.c:21: undefined reference to `_imp____glewGenBuffers'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug/AnimationFramework_0.exe] Error 1
mingw32-make: Leaving directory `<project_path>'
mingw32-make: *** [debug] Error 2
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project <project_name> (target: Desktop)
When executing build step 'Make'
debug/cube.o: In function `DrawCube':
<project_path>/cube.c:21: undefined reference to `_imp____glewGenBuffers'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug/AnimationFramework_0.exe] Error 1
mingw32-make: Leaving directory `<project_path>'
mingw32-make: *** [debug] Error 2
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project <project_name> (target: Desktop)
When executing build step 'Make'
To copy to clipboard, switch view to plain text mode
The line on cube.c:21 is: glGenBuffers((GLsizei)1, &a);
Not sure where the name mangling is happening, but it seems like it's linking okay..kind of lost where to go. Not sure where the other function is coming from? Perhaps C++, I mean it is C++ and it's calling a C function, but I'd imagine it's okay in this context.
Any help is appreciated.
EDIT:
Just for a sanity check I gave the problematic function a cpp extension so it compiles to a cpp object, the error is the same (slightly) different, reads:
debug/cube.o: In function `Z8DrawCubev':
<project_path/cube.cpp:21: undefined reference to `_imp____glewGenBuffers'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug/<final_binary>] Error 1
mingw32-make: *** [debug] Error 2
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project <project_name> (target: Desktop)
When executing build step 'Make'
debug/cube.o: In function `Z8DrawCubev':
<project_path/cube.cpp:21: undefined reference to `_imp____glewGenBuffers'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug/<final_binary>] Error 1
mingw32-make: *** [debug] Error 2
The process "C:/Qt/2010.05/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project <project_name> (target: Desktop)
When executing build step 'Make'
To copy to clipboard, switch view to plain text mode
The function it's referring to (where the error is) is just called DrawCube(), the prototype is: void DrawCube(), it isn't a member function nor does it have any special attributes.
EDIT2:
Now the top of my .pro file looks like this:
LIBS += -lglew32 -LC:\Qt\2010.05\mingw\bin -LC:\Qt\2010.05\mingw\lib
QT += core gui opengl
INCLUDEPATH += C:\Qt\2010.05\mingw\include\GL
LIBS += -lglew32 -LC:\Qt\2010.05\mingw\bin -LC:\Qt\2010.05\mingw\lib
QT += core gui opengl
INCLUDEPATH += C:\Qt\2010.05\mingw\include\GL
To copy to clipboard, switch view to plain text mode
Now it compiles, but glewInit() fails...that's typically a "I don't know where the hell to find this resource" issue..
Bookmarks