error: GL/gl.h: No such file or directory文章来源:https://www.toymoban.com/news/detail-695900.html
该问题表示没有Opengl库,文章来源地址https://www.toymoban.com/news/detail-695900.html
#安装opengl
sudo apt-get install mesa-common-dev
#提示源找不到资源
Err:1 http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 libx11-dev amd64 2:1.6.4-3ubuntu0.5
404 Not Found [IP: 218.24.90.216 80]
Ign:2 http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 libx11-doc all 2:1.6.4-3ubuntu0.5
Err:2 http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 libx11-doc all 2:1.6.4-3ubuntu0.5
404 Not Found [IP: 218.24.90.216 80]
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/pool/main/libx/libx11/libx11-dev_1.6.4-3ubuntu0.5_amd64.deb 404 Not Found [IP: 218.24.90.216 80]
E: Failed to fetch http://mirrors.aliyun.com/ubuntu/pool/main/libx/libx11/libx11-doc_1.6.4-3ubuntu0.5_all.deb 404 Not Found [IP: 218.24.90.216 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
#更换source.list
sudo vim /etc/apt/sources.list
#将源改为中国科学技术大学的源
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-backports main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-proposed main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-security main multiverse restricted universe
deb-src http://mirrors.ustc.edu.cn/ubuntu-ports/ xenial-updates main multiverse restricted universe
#更新命令
sudo apt update
#继续安装
sudo apt-get install mesa-common-dev
#提示版本依赖不对
The following packages have unmet dependencies:
libx11-dev : Depends: libx11-6 (= 2:1.6.4-3ubuntu0.4) but 2:1.6.4-3ubuntu0.5 is to be installed
Recommends: libx11-doc but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
#解决版本问题
sudo apt install libx11-6=2:1.6.4-3ubuntu0.4
#创建软链接
sudo ln -s /usr/lib/x86_64-linux-gnu/libGL.so.1 libGL.so
到了这里,关于qcreator编译出现: error: GL/gl.h: No such file or directory的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!