When I need to change versions of software I use on Ubuntu, e.g., gcc and g++ and Java.
Update-alternatives
A neat way to do it is using update-alternatives. This how you have to do it with gcc:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
sudo update-alternatives --config gcc
References
[1] http://charette.no-ip.com:81/programming/2011-12-24_GCCv47/
Go Top