How to install g++ 10 on Ubuntu 18.04?

Solution 1:

gcc-10 is now available in the Ubuntu tool chains.

Add the PPA and install gcc-10:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install gcc-10

For g++-10:

   sudo apt install g++-10