PDA

View Full Version : QGL in QTcreator 2.5.2



fiodis
1st November 2012, 17:29
Hello all,
I've been trying to get a widget to display graphics using OpenGL 3.1. I've done OpenGL coding before, mainly with freeglut, but I need an easy framework to control variables, and QT's widgets seem perfect. However, I've been having trouble getting OGL 3.0+ to work properly. I've followed this (http://www.youtube.com/watch?v=1nzHSkY4K18) tutorial to the click, but when he builds his project at 5:10, I get a message complaining about an unresolved external symbol in mainwindow.obj:

mainwindow.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall GLWidget::GLWidget(class QObject *)" (??0GLWidget@@QAE@PAVQObject@@@Z) referenced in function "public: void __thiscall Ui_MainWindow::setupUi(class QMainWindow *)" (?setupUi@Ui_MainWindow@@QAEXPAVQMainWindow@@@Z)
with this as the compiling output:

13:27:02: Running steps for project yet_more_ogl...
13:27:02: Configuration unchanged, skipping qmake step.
13:27:02: Starting: "C:\Qt\qtcreator-2.5.2\bin\jom.exe"
C:\Qt\qtcreator-2.5.2\bin\jom.exe -f Makefile.Debug
link /LIBPATH:"c:\Qt\4.8.3opensource\lib" /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /MANIFEST /MANIFESTFILE:"debug\yet_more_ogl.intermediate.manifest" /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /OUT:debug\yet_more_ogl.exe @C:\Users\Matt\AppData\Local\Temp\yet_more_ogl.exe .4152.0.jom
mainwindow.obj : error LNK2019: unresolved external symbol "public: __thiscall GLWidget::GLWidget(class QObject *)" (??0GLWidget@@QAE@PAVQObject@@@Z) referenced in function "public: void __thiscall Ui_MainWindow::setupUi(class QMainWindow *)" (?setupUi@Ui_MainWindow@@QAEXPAVQMainWindow@@@Z)
debug\yet_more_ogl.exe : fatal error LNK1120: 1 unresolved externals
jom: C:\Qt\qtcreator-2.5.2\project\yet_more_ogl-build-desktop-Qt_4_8_3_in_PATH__4_8_3opensource__Debug\Makefile. Debug [debug\yet_more_ogl.exe] Error 1120
jom: C:\Qt\qtcreator-2.5.2\project\yet_more_ogl-build-desktop-Qt_4_8_3_in_PATH__4_8_3opensource__Debug\Makefile [debug] Error 2
13:27:02: The process "C:\Qt\qtcreator-2.5.2\bin\jom.exe" exited with code 2.
Error while building/deploying project yet_more_ogl (target: Desktop)
When executing step 'Make'
I'm not sure what I did wrong, as I followed the tutorial almost exactly. The one difference is that I kept the menu bar at the top of the main window, since it would come in handy later. I don't see how that should break by build. Can anyone suggest something I should try?

fiodis
2nd November 2012, 00:41
Hmm, I'm not sure how to edit my previous post. I believe I've solved the problem; for some reason rebooting the computer and reloading the project fixed the issue. :confused:

However, now I can't get GLEW to work. I've made sure to include it before any QGL includes, and the project builds fine if I don't call any glew functions. But if I have glewInit in the initializeGL function, QTCreator complains:

glwidget.obj:-1: error: LNK2019: unresolved external symbol __imp__glewInit@0 referenced in function "public: virtual void __thiscall GLWidget::initializeGL(void)" (?initializeGL@GLWidget@@UAEXXZ)
I'm not sure what's off here. I have the #include in the right place and all. I had glew32.lib in C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib, but the error persisted even after I moved it to C:\Qt\4.8.3opensource\lib. Do I have to set up the linker somehow?