1. 程式人生 > >將gcc-4.8降級為gcc-4.6

將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 gccsudo 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.