改变gcc版本

 ls /usr/bin/gcc -l

一般情况下,编译程序都是使用的

/usr/bin/gcc

它指向了/etc/alternatives/gcc,而/etc/alternatives/gcc是指向了/usr/bin/gcc-4.3,

可以用ls命令查看

ls /usr/bin/gcc -l

ls /etc/alternatives/gcc -l

看一下当前安装的gcc的各个版本

 ls /usr/bin/gcc* -l

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.3 40
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-3.4 30


sudo update-alternatives --config gcc


原文地址:https://www.cnblogs.com/greencolor/p/1628514.html