Skip to content

Instantly share code, notes, and snippets.

@gmas
Created December 25, 2014 22:38
Show Gist options
  • Save gmas/b5fd3d038905d1265485 to your computer and use it in GitHub Desktop.
Save gmas/b5fd3d038905d1265485 to your computer and use it in GitHub Desktop.
switch gcc versions in debian
#install new versions of gcc and g++
sudo apt-get install gcc-4.8 g++-4.8
#remove existing alternatives
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
#add new and old version to update-alternatives db
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.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
#choose the needed version
sudo update-alternatives --config gcc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment