sudo apt install build-essential
gcc --version    (查看gcc版本)

可以看到我的gcc版本是4.8.5

安装最新版gcc9
sudo apt install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt install gcc-9 g++-9

查看各个gcc版本的优先级,分数越高优先级越高

sudo update-alternatives --config gcc

  

更改优先级(可以用以下命令,将你想要的gcc版本优先级改为最高)

 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100

Logo

更多推荐