Skip to content

Instantly share code, notes, and snippets.

@stonexjr
Created November 27, 2018 20:19
Show Gist options
  • Save stonexjr/1236c2bd6666d6f904b5ce84b76df789 to your computer and use it in GitHub Desktop.
Save stonexjr/1236c2bd6666d6f904b5ce84b76df789 to your computer and use it in GitHub Desktop.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update && \
sudo apt-get install gcc-6 g++-6 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
gcc -v
@stonexjr
Copy link
Author

stonexjr commented Jan 31, 2020

sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt-get update && \
sudo apt-get install gcc-9 g++-9 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9 && \
sudo apt-get install gcc-7 g++-7 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-7

When completed, you must change to the gcc you want to work with by default. Type in your terminal:

sudo update-alternatives --config gcc

To verify if it worked. Just type in your terminal

gcc -v

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment