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
At the end you need to update the alternatives for compilers (reference):
#Remove the previous alternatives
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
#Define the compiler
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 30
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 30
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
#Confirm and update (You can use the default setting)
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
Answer from P.P on askubuntu.comGitHub
gist.github.com › application2000 › 73fd6f4bf1be6600a2cf9f56315a2d91
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04) · GitHub
As a side note, the daily build of the next Ubuntu 20.10 does install 10.1.0. Today's screenshot of repo https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/+packages: ... sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get install build-essential software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt-get update -y && sudo apt-get install gcc-10 g++-10 -y && sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 60 --slave /usr/bin/g++ g++ /usr/bin/g++-10 && sudo update-alternatives --config gcc
Videos
07:50
How to Install GCC the C compiler on Ubuntu 24.04 LTS Linux
11:57
How to Install GCC and G++ Compiler on Ubuntu 24.04 LTS (Linux) ...
14:02
How to Install GCC and G++ Compiler on Ubuntu 22.04 LTS (Linux) ...
08:55
How to Install GCC the C compiler on Ubuntu 22.04 LTS Linux - YouTube
Ubuntu
packages.ubuntu.com › focal › gcc-10
Details of package gcc-10 in focal
two or more packages specified (gcc-10 focal) Content Copyright © 2025 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
Ahelpme
ahelpme.com › home › linux › ubuntu › install and make gnu gcc 10 default in ubuntu 20.04 focal
Install and make GNU GCC 10 default in Ubuntu 20.04 Focal | Any IT here? Help Me!
October 18, 2021 - Use sudo before each command, if installation is performed by a user other than root: sudo apt update -y sudo apt upgrade -y sudo apt install -y build-essential sudo apt install -y gcc-10 g++-10 cpp-10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ ...
Top answer 1 of 2
9
Tested on Ubuntu 20.04:
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt update
sudo apt install g++-10
2 of 2
2
I replaced the version used in this article with mine and installed to /usr/loacl/bin instead.
Then I needed to update the gcc alternatives as shown here. I replaced this version with mine. I used /usr/local/bin/gcc-10.2.0/bin/gcc-10.2 to use the executable instead of the folder. It's currently working for me.
LinuxCapable
linuxcapable.com › home › ubuntu › how to install gcc on ubuntu 26.04, 24.04 and 22.04
How to Install GCC on Ubuntu 26.04, 24.04 and 22.04 - LinuxCapable
1 week ago - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 120 \ --slave /usr/bin/g++ g++ /usr/bin/g++-12 \ --slave /usr/bin/gcov gcov /usr/bin/gcov-12 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 \ --slave /usr/bin/g++ g++ /usr/bin/g++-11 \ --slave /usr/bin/gcov gcov /usr/bin/gcov-11 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 \ --slave /usr/bin/g++ g++ /usr/bin/g++-10 \ --slave /usr/bin/gcov gcov /usr/bin/gcov-10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 \ --slave /usr/bin/g++ g++ /usr/bin/g++-9 \ --slave /usr/bin/gcov gcov /usr/bin/gcov-9 · If you installed GCC 15 from the Toolchain Test PPA on Ubuntu 24.04 or 22.04, register it with the same pattern:
Solarian Programmer
solarianprogrammer.com › 2016 › 10 › 07 › building-gcc-ubuntu-linux
Building GCC 10 on Ubuntu Linux | Solarian Programmer
October 7, 2016 - 1 cd ~ 2 mkdir build && cd build 3 ../gcc-10.1.0/configure -v --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --prefix=/usr/local/gcc-10.1.0 --enable-checking=release --enable-languages=c,c++,fortran --disable-multilib --program-suffix=-10.1 · Now, we are ready to ...
Ubuntu
launchpad.net › ubuntu › focal › i386 › gcc-10-base › 10.3.0-1ubuntu1~20.04
10.3.0-1ubuntu1~20.04 : gcc-10-base : i386 : Focal (20.04) : Ubuntu
i386 build of gcc-10 10.3.0-1ubuntu1~20.04 in ubuntu focal RELEASE produced these files: gcc-10-base_10.3.0-1ubuntu1~20.04_i386.deb (19.7 KiB) Breaks: gnat (<< 7) • Take the tour • Read the guide · © 2004 Canonical Ltd.
LinuxConfig
linuxconfig.org › home › how to switch between multiple gcc and g++ compiler versions on ubuntu 22.04 lts jammy jellyfish
Install GCC G++ on Ubuntu 22.04 Easily
February 28, 2022 - $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 $ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9 $ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9 $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 $ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 · Check the available C and C++ compilers list on your Ubuntu 22.04 system and select desired version by entering relevant selection number:
GNU
gcc.gnu.org › install
Installing GCC - GNU Project
The latest version of this document is always available at https://gcc.gnu.org/install/. It refers to the current development sources, instructions for specific released versions are included with the sources.
Ubuntu
packages.ubuntu.com › focal › gcc-10-base
Details of package gcc-10-base in focal
two or more packages specified (gcc-10-base focal) Content Copyright © 2025 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
Ubuntu
packages.ubuntu.com › focal › amd64 › gcc-10-base › download
gcc-10-base_10.5.0-1ubuntu1~20.04_amd64.deb
two or more packages specified (gcc-10-base focal) Content Copyright © 2025 Canonical Ltd.; See license terms. Ubuntu is a trademark of Canonical Ltd. Learn more about this site.
Ubuntu
packages.ubuntu.com › gcc
Ubuntu – Package Search Results -- gcc
October 20, 2022 - noble (24.04LTS) (devel): GNU C compiler (cross compiler for armhf architecture) [universe] 10.5.0-4ubuntu2cross1: amd64 arm64 i386 ppc64el · jammy (22.04LTS) (devel): GCC, the GNU Compiler Collection (base package) [universe] 10.5.0-1ubuntu1~22.04cross1 [security]: amd64 i386 10.3.0-8ubuntu1cross1 [ports]: arm64 ppc64el