1. 程式人生 > >Ubuntu 18.04 將gcc版本降級為5.5版本

Ubuntu 18.04 將gcc版本降級為5.5版本

首先檢視自己的gcc版本,Ubuntu18.04上預設的是7.3版本

>>gcc --version
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

1. 下載gcc/g++ 5

sudo apt-get install -y gcc-5
sudo apt-get install -y g++-5

2. 連結gcc/g++實現降級

cd /usr/bin
sudo rm gcc
sudo ln -s gcc-5 gcc
sudo rm g++
sudo ln -s g++-5 g++

再次檢視gcc版本,可以看到已經降級.

>>gcc --version
gcc (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
Copyright (C) 2015 Free Software Foundation,
Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.