问题:
qt编译时报错
.../gcc_64/include/QtGui/qopengl.h:142: error: GL/gl.h: No such file or directory
原因
系统未安装opengl库文件。
解决办法
安装opengl。注意用aptitude命令比用apt-get指令处理各种库文件依赖关系更方便。
ema@ubuntu:~$ sudo aptitude install libgl1-mesa-dev
The following NEW packages will be installed:
libdrm-dev{ab} libgl1-mesa-dev{b} libx11-xcb-dev{ab} libxcb-dri2-0-dev{a} libxcb-dri3-dev{a} libxcb-glx0-dev{a} libxcb-present-dev{a} libxcb-randr0-dev{a} libxcb-shape0-dev{a}
libxcb-sync-dev{a} libxcb-xfixes0-dev{a} libxshmfence-dev{a} libxxf86vm-dev{a} mesa-common-dev{a} x11proto-dri2-dev{a} x11proto-gl-dev{a} x11proto-xf86vidmode-dev{a}
0 packages upgraded, 17 newly installed, 0 to remove and 1 not upgraded.
Need to get 829 kB of archives. After unpacking 5,671 kB will be used.
The following packages have unmet dependencies:
libx11-xcb-dev : Depends: libx11-xcb1 (= 2:1.6.3-1ubuntu2) but 2:1.6.3-1ubuntu2.2 is installed.
libgl1-mesa-dev : Depends: libgl1-mesa-glx (= 11.2.0-1ubuntu2) but 18.0.5-0ubuntu0~16.04.1 is installed.
libdrm-dev : Depends: libdrm2 (= 2.4.67-1) but 2.4.91-2~16.04.1 is installed.
Depends: libdrm-intel1 (= 2.4.67-1) but 2.4.91-2~16.04.1 is installed.
Depends: libdrm-radeon1 (= 2.4.67-1) but 2.4.91-2~16.04.1 is installed.
Depends: libdrm-nouveau2 (= 2.4.67-1) but 2.4.91-2~16.04.1 is installed.
Depends: libdrm-amdgpu1 (= 2.4.67-1) but 2.4.91-2~16.04.1 is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
-
libdrm-dev [Not Installed]
-
libgl1-mesa-dev [Not Installed]
-
libx11-xcb-dev [Not Installed]
-
mesa-common-dev [Not Installed]
Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:
Remove the following packages:
-
xserver-xorg-video-all-hwe-16.04
-
xserver-xorg-video-amdgpu-hwe-16.04
Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
Setting up x11proto-gl-dev (1.4.17-1) …
Setting up libgl1-mesa-dev:amd64 (11.2.0-1ubuntu2) …
Processing triggers for libc-bin (2.23-0ubuntu11.3) …
ema@ubuntu:~$