Skip to content

Instantly share code, notes, and snippets.

@sdmoko
Created June 6, 2017 05:11
Show Gist options
  • Save sdmoko/d2ce796d1516cfacab696aa54a23bf17 to your computer and use it in GitHub Desktop.
Save sdmoko/d2ce796d1516cfacab696aa54a23bf17 to your computer and use it in GitHub Desktop.
Configure gcc to using specific version
#install new versions of gcc and g++
sudo apt-get install gcc-5 gcc g++-5 g++
#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-5 50 --slave /usr/bin/g++ g++ /usr/bin/g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
#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