我正在运行64位Ubuntu 14.04。
我得到的编译错误是:
In file included from ../../../Qt/5.4/gcc_64/include/QtOpenGL/qgl.h:39:0,
from ../../../Qt/5.4/gcc_64/include/QtOpenGL/qglshaderprogram.h:37,
from ../../../Qt/5.4/gcc_64/include/QtOpenGL/QGLShaderProgram:1,
from glwidget.h:5,
from glwidget.cpp:1:
../../../Qt/5.4/gcc_64/include/QtGui/qopengl.h:122:21: fatal error: GL/gl.h: No such file or directory
# include <GL/gl.h>
^
奇怪的是,我似乎已经正确安装了libGL.so并将其符号链接到我的Nvidia 343显示驱动程序(我想还安装了OpenGL驱动程序)所安装的OpenGL库中。
$ ls -l /usr/lib | grep -i libgl
lrwxrwxrwx 1 root root 17 Jan 15 12:47 libGLESv1_CM.so -> libGLESv1_CM.so.1
lrwxrwxrwx 1 root root 22 Jan 15 12:47 libGLESv1_CM.so.1 -> libGLESv1_CM.so.343.36
-rwxr-xr-x 1 root root 48248 Jan 15 12:47 libGLESv1_CM.so.343.36
lrwxrwxrwx 1 root root 14 Jan 15 12:47 libGLESv2.so -> libGLESv2.so.2
lrwxrwxrwx 1 root root 19 Jan 15 12:47 libGLESv2.so.2 -> libGLESv2.so.343.36
-rwxr-xr-x 1 root root 62352 Jan 15 12:47 libGLESv2.so.343.36
-rw-r--r-- 1 root root 654 Jan 15 12:47 libGL.la
lrwxrwxrwx 1 root root 10 Jan 15 12:47 libGL.so -> libGL.so.1
lrwxrwxrwx 1 root root 15 Jan 15 12:47 libGL.so.1 -> libGL.so.343.36
-rwxr-xr-x 1 root root 1274520 Jan 15 12:47 libGL.so.343.36
我以前看过一些建议做的事
sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev
但是当我尝试这样做时,它将我支持的OpenGL版本(由glxinfo输出)降级为v1.4。我也不确定为什么应该有所帮助。
这是我的glxinfo输出。
$ glxinfo | grep -i opengl
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 970/PCIe/SSE2
OpenGL core profile version string: 4.3.0 NVIDIA 343.36
OpenGL core profile shading language version string: 4.30 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.4.0 NVIDIA 343.36
OpenGL shading language version string: 4.40 NVIDIA via Cg compiler
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
谢谢
mesa-common-dev
安装软件包?