-
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
-
sudo apt-get update
-
sudo apt-get install gcc-7
-
sudo apt-get install g++-7
出现以下错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
gcc-7 : Depends: cpp-7 (= 7.5.0-3ubuntu1~16.04) but it is not going to be installed
Depends: libgcc-7-dev (= 7.5.0-3ubuntu1~16.04) but it is not going to be installed
wine-wechat : Depends: wine-stable but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
sudo apt --fix-broken install
然后继续:
sudo apt-get install gcc-7
切换gcc版本
-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 100

本文介绍了如何在Ubuntu系统中通过PPA源安装GCC 7版本,包括添加PPA、更新源、修复依赖错误,并切换gcc和g++版本的过程,适合初学者参考。
最低0.47元/天 解锁文章
763

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



