Problems with compiling OpenGL using Qt
Software Version: Qt 4.8.5
According to the online routines (http://www.qiliang.net/old/nehe_qt/lesson01.html), ran Based on Qt Creator OpenGL. Because the Qt version of the above routine is older (the routine is for 02 years, Khan !), There are many problems in the new Qt environment. Fortunately, they have been solved one by one. The following is an illustration:
1. You need to add OpenGL support in the project file. pro:
QT + = opengl (remember to clear the project and compile it again !)
Otherwise, there will be a lot of problems like error: undefined reference to 'glshademodel @ 4', error: undefined reference to 'glclearcolor @ 16.
2. setCaption: [error: "setCaption 'was not declared in this scope]
In the new version, it is replaced by the setWindowTitle () function:
SetCaption ("Qt Open-GL"); --> setWindowTitle ("Qt Open-GL ");
3. For functions starting with glu, such as gluPerspective (): [error: 'gluperspective 'was not declared in this scope], the header file must be included.
# Include
4. If QKeyEvent is used, the header file [error: invalid use of incomplete type 'struct qkeyevent'] must be included.
# Include