Selecting compiler versions with update-alternatives

switch between multiple compiler versions

Switch between compilers e.g. gcc-5 and gcc-6 with simple commands like:

update-alternatives --config g++
update-alternatives --config gfortran

You can of course do this with any program.

Add compilers to update-alternatives

Example of adding gcc-7:

apt install gcc-7

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 10

Categories:

Updated:

Leave a Comment