/home/xxxx/Qt5.6.0/5.6/gcc_64/include/QtGui/qopengl.h:120: error: GL/gl.h: No such file or directory
我在ubuntu上安装了qt5.6,然后编译demo的时候提示上述错误,搜索到了解决办法:
Linux
OpenGL support is very easy to enable on current Linux distributions. For distributions derived from RedHat Linux, the libraries and header files are installed using the commandyum install freeglut-devel
Since GLUT depends on OpenGL and a number of other libraries, installing GLUT will trigger the dependencies needed to install everything else. For distributions derived from Debian such as Ubuntu, the installation command is
apt-get install freeglut3-dev
To compile and link your program on Ubuntu 14 based distros you need to explicitly grab every library using
gcc -o foo foo.c -lglut -lGLU -lGL -lm
I recommend that you use this full version even if not required on your system. Older distributions may put the files in /usr/X11R6, in which case you need to add -I and -L flags to pick up the header files and libraries.
Once installed, run the glxinfo program and look for direct rendering in the output. If the result is YES, then hardware support for OpenGL is working. If it is NO, some things are done in software and you may take a performance hit. Depending on your hardware, you may want to work on your X server. Specifically, the nVidia and AMD/ATI web sites contains updated drivers that result in improved performance over the stock Xorg drivers.
The compiz window manager (which is an OpenGL window manager) makes applications which use glutIdleFunc() run jerky unless you enable VSync. This seems to be an issue especially with newer Ubuntu installs.
在Ubuntu上安装Qt5.6并尝试编译时遇到GL/gl.h缺失的问题。解决方案是通过apt-get install freeglut3-dev安装必要的库。确保OpenGL支持,运行glxinfo检查硬件加速状态。如果Direct Rendering为NO,可能需要更新Xserver驱动。编译时使用gcc指定库链接。
3264

被折叠的 条评论
为什么被折叠?



