将gcc-4.8降级为gcc-4.6

版本并非越高越好!当初升级到4.8是为了编译一个程序,但是有些程序在以前低版本系统上安装一点错误都没有,但是在高版本gcc上面却出现错误。还是退回去好了...


降级其实和升级方法基本一样:


先清除原来的版本:

sudo update-alternatives --remove-all gcc

sudo update-alternatives --remove-all g++


安装指定版本

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20


配置更改:

sudo update-alternatives --config gcc
sudo update-alternatives --config g++


查看修改完的版本:

gcc --version

gcc (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) 4.6.4

Copyright (C) 2011 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.


g++ --version

g++ (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) 4.6.4

Copyright (C) 2011 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.



更全的操作请参考:http://askubuntu.com/questions/26498/choose-gcc-and-g-version?lq=1


你可能感兴趣的:(linux,gcc,ubuntu)