Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save zzjjzzgggg/d287e8aa001030f059020ccf1b76a8ed to your computer and use it in GitHub Desktop.

Select an option

Save zzjjzzgggg/d287e8aa001030f059020ccf1b76a8ed to your computer and use it in GitHub Desktop.
How to install latest gcc on Ubuntu LTS 16.04, Linux Mint 18.1
# These commands are based on a askubuntu answer http://askubuntu.com/a/581497
# To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
# USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
# ABSOLUTELY NO WARRANTY.
# If you are still reading let's carry on with the code.
sudo apt-get update
sudo apt-get install build-essential software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-7 g++-7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 60
# When completed, you must change to the gcc you want to work with by default. Type in your terminal:
sudo update-alternatives --config gcc
# and select gcc-7
#To verify if it worked. Just type in your terminal
gcc -v
# If everything went fine you should see gcc 7.1 by the time I am writing this gist
# Happy coding!
# See my blog post at https://www.application2000.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment