I recently used QT5.2 to learn OpenGL in Windows 7. I recently used QT5.2 to learn OpenGL in Windows 7. I recently used QT5.2 to learn OpenGL.
‘GluPerspective’ was not declared in this scope. The version of Qt used in this article is
Qt 5.2.0 for Windows 32-bit (MinGW 4.8, OpenGL, 689 MB)
(Info), you can see the Qt version download information under various platforms from the Qt official website http://qt-project.org/downloads.
I searched the web for the following related solutions, which are for lower versions of Qt, such as this article: The GLU header file is not available for common Qt errors. I gave it a try and finally solved the problem with QT5.2 under Windows 7.
1. Add a header file to the source file of the glu library that references functions like gluPerspective: #include< gl/glu.h>
This step is necessary. For some reason, Glu32 libraries that start with glu and use OpenGL under QT5.2 also need to include GL /glu.h headers, while OpenGL32 libraries that start with GLL in OpenGL do not need to include headers.
Download Glut. lib and Glut32. lib and copy them to your Qt installation directory in Qt5.2.0\5.2.0\mingw48_32\lib, so that the Qt compiler will automatically search for the corresponding library files in the Qt installation directory.
This step may not be necessary.
Finally, I have tried the OpenGL under Qt (2) in my Qt5.2 environment (2) and the OpenGL example in C++ GUI Programming with Qt4(2nd Edition) Chapter 20. Make sure that after the above configuration, GluPerspective (45.0,(GLFloat)width/(GLFloat)height,0.1,100.0); And gluPickMatrix (GLdouble (pos) (x)), GLdouble (viewport [3] – pos. Y ()), 5.0, 5.0, viewport); These two lines of code work.
Reproduced in: https://www.cnblogs.com/lvdongjie/p/4775473.html
Read More:
- Configuring OpenGL in Chinese version of VS2010 and problem solving
- A series of problems in configuring OpenGL development environment in vs2015
- |-OpenGL – | some small problems about the glut Library
- The solution of configuring OpenGL in vs2017
- OpenGL class library and environment configuration under win10 and vs2015
- The first day of OpenGL [vs2017 + OpenGL environment configuration]
- Vc2010 configuring OpenGL environment
- Configuring OpenGL development environment in win10 + vs2015 (including the method of installing 32-bit and 64 bit libraries)
- Using glut in CodeBlocks
- Vs compiling OpenGL project, the solution of unable to open the source file “GL / glaux. H” appears
- Vs2015 + OpenGL environment configuration
- OpenGL program running prompt glut32.dll missing problem
- The simplest way to configure OpenGL development environment with vs2015
- Error in header file when calling OpenGL to open obj file in vs2013: unable to open include file: “GL / glut. H”: no such file or directories
- Configure OpenGL in CodeBlocks
- Error: unable to open include file: ‘GL / glut. H’
- Vs2015 configuring OpenGL development environment: configuration of glfw library and glad Library
- Solution of VS2008 unable to open GL / glaux. H header file
- Configuring OpenGL in Code:: blocks
- CodeBlocks configuring OpenGL