Configuring multiple GCC in same Ubuntu machine

Ubuntu (Source)
$ sudo apt-get install gcc g++$ gcc -vgcc version 7.3.0
$ sudo apt-get install gcc-6 g++-6$ gcc-6 -vgcc version 6.5.0
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 2 --slave /usr/bin/g++ g++ /usr/bin/g++-7$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 1 --slave /usr/bin/g++ g++ /usr/bin/g++-6
$ sudo update-alternatives --config gccThere are 2 choices for the alternative gcc (providing /usr/bin/gcc).  Selection    Path            Priority   Status------------------------------------------------------------* 0            /usr/bin/gcc-7   2         auto mode
1 /usr/bin/gcc-6 1 manual mode
2 /usr/bin/gcc-7 2 manual mode
Press <enter> to keep the current choice[*], or type selection number:
$ gcc -vgcc version 6.5.0

Tested with Ubuntu 18.04 LTS

--

--

Machine Learning Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store