Skip to content

Cplusplus 17 Installation

hlx1996 edited this page Jun 25, 2019 · 2 revisions
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test

$ sudo apt-get update

$ sudo apt-get install gcc-7 g++-7

use the following command to check your gcc compilers

$ ls -lh /usr/bin/g++*

for ubuntu 14.04:

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8

for ubuntu 16.04:

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5

then

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7

use the folling command to change the default compiler (choose 0 as default)

$ sudo update-alternatives --config gcc

check your current gcc compiler

$ gcc --version
Clone this wiki locally