[Solved] OpenGL doesnt work in latest QtSdk 1.1 beta
With the new version QtSdk 1.1 beta my existent project doesnt work , simple OpenGL functions are not recgnized
- graph2Dclass\graph2d.cpp: In member function 'void Graph2D::draw()':
- graph2Dclass\graph2d.cpp:302: error: 'GL_LINE_STRIP' was not declared in this scope
- graph2Dclass\graph2d.cpp:302: error: 'glBegin' was not declared in this scope
- graph2Dclass\graph2d.cpp:314: error: 'glVertex3d' was not declared in this scope
- graph2Dclass\graph2d.cpp:328: error: 'glEnd' was not declared in this scope
- graph2Dclass\graph2d.cpp:335: error: 'glEnd' was not declared in this scope
- graph2Dclass\graph2d.cpp:345: error: 'glEnd' was not declared in this scope
5 replies
Do you have
- QT += opengl
in your project’s .pro file? What is the full command line passed to the compiler that generates the above error message?
I have that line in the .pro file since it’s a existente project. I found that OpenGL works with other project I have so probably it’s not QtSdk installation problem.
What is the full command line passed to the compiler that generates the above error message?
Do you mean this
- Running build steps for project matematica...
- Configuration unchanged, skipping qmake step.
- Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe" -w
- mingw32-make: Entering directory `D:/qt4examples/Matematica_determinante'
- C:/QtSDK/mingw/bin/mingw32-make -f Makefile.Debug
- mingw32-make[1]: Entering directory `D:/qt4examples/Matematica_determinante'
- g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\QtSDK\Desktop\Qt\4.7.2\mingw\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.2\mingw\include\QtGui" -I"c:\QtSDK\Desktop\Qt\4.7.2\mingw\include\QtOpenGL" -I"c:\QtSDK\Desktop\Qt\4.7.2\mingw\include" -I"." -I"." -I"c:\QtSDK\Desktop\Qt\4.7.2\mingw\include\ActiveQt" -I"debug" -I"." -I"c:\QtSDK\Desktop\Qt\4.7.2\mingw\mkspecs\win32-g++" -o debug\graph2d.o graph2Dclass\graph2d.cpp
- graph2Dclass\graph2d.cpp: In member function 'void Graph2D::draw()':
- graph2Dclass\graph2d.cpp:302: error: 'GL_LINE_STRIP' was not declared in this scope
- graph2Dclass\graph2d.cpp:302: error: 'glBegin' was not declared in this scope
- graph2Dclass\graph2d.cpp:314: error: 'glVertex3d' was not declared in this scope
- graph2Dclass\graph2d.cpp:328: error: 'glEnd' was not declared in this scope
- graph2Dclass\graph2d.cpp:335: error: 'glEnd' was not declared in this scope
- graph2Dclass\graph2d.cpp:345: error: 'glEnd' was not declared in this scope
- mingw32-make[1]: Leaving directory `D:/qt4examples/Matematica_determinante'
- mingw32-make: Leaving directory `D:/qt4examples/Matematica_determinante'
- mingw32-make[1]: *** [debug/graph2d.o] Error 1
- mingw32-make: *** [debug] Error 2
- The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited with code 2.
- Error while building project matematica (target: Desktop)
- When executing build step 'Make'
Hmmm, yes that is what I meant. The command line looks fine. It is pulling in the correct include path for the QtOpenGL support and has the relevent define on the command line too (-DQT_OPENGL_LIB).
As you say other OpenGL based projects work fine for you the error must be somewhere in this project. Can you post the .pro file and the source for this file that is failing to compile please?
I found the error, it was missing a
- #include <QGLWidget>
in graph2d.h. Althout this class is not QGLWidget derived, it is called from a QGLWidget object, and since it has OpenGL functions it was complaining about this missing header.
I probably erased this include accidentally, since this was a existent project working ok in previous QtSdk versions.
Thank you.
You must log in to post a reply. Not a member yet? Register here!


