You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

install-newer-g++.sop 1.1KB

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