|
|
|
|
|
|
|
|
|
|
|
How to install multiple versions of c++ (gcc, g++) and set up their aliass on ubuntu |
|
|
|
|
|
Refer to https://tuxamito.com/wiki/index.php/Installing_newer_GCC_versions_in_Ubuntu |
|
|
|
|
|
|
|
|
|
|
|
[ ] Add the repository |
|
|
|
|
|
[ ] sudo add-apt-repository ppa:ubuntu-toolchain-r/test |
|
|
|
|
|
[ ] sudo apt-get update |
|
|
|
|
|
|
|
|
|
|
|
[ ] Install compilers |
|
|
|
|
|
[ ] sudo apt-get install gcc g++ gcc-7 g++-7 gcc-8 g++-8 gcc-9 g++-9 |
|
|
|
|
|
|
|
|
|
|
|
[ ] Clear any alternatives already in place |
|
|
|
|
|
[ ] sudo update-alternatives --remove-all gcc |
|
|
|
|
|
|
|
|
|
|
|
[ ] Set up alternatives |
|
|
|
|
|
[ ] sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 90 --slave /usr/bin/g++ g++ /usr/bin/g++-7 |
|
|
|
|
|
[ ] sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g++-8 |
|
|
|
|
|
[ ] sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 70 --slave /usr/bin/g++ g++ /usr/bin/g++-9 |
|
|
|
|
|
|
|
|
|
|
|
[ ] Configure the compiler to use |
|
|
|
|
|
[ ] sudo update-alternatives --config gcc |
|
|
|
|
|
This will show choices along with the current selected compiler version |
|
|
|
|
|
[ ] Pick the compiler version you want to use |
|
|
|
|
|
[ ] Verify the choice |
|
|
|
|
|
[ ] g++ -v |
|
|
|
|
|
|