I'm still on Ubuntu 22.04 LTS but needed g++14. The sudo apt-get gcc-14 did not work for me, as it installed clang++14 for some reason (perhaps a misconfiguration on my part). What did work for me was following the instructions I found at https://www.dedicatedcore.com/blog/install-gcc-compiler-ubuntu/

The steps I took:

sudo apt install build-essential
sudo apt install libmpfr-dev libgmp3-dev libmpc-dev -y
wget https://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.gz
tar -xf gcc-14.1.0.tar.gz
cd gcc-14.1.0
./configure -v --build=$(uname -m)-linux-gnu --host=$(uname -m)-linux-gnu --target=$(uname -m)-linux-gnu --prefix=/usr/local/gcc-14.1.0 --enable-checking=release --enable-languages=c,c++ --disable-multilib --program-suffix=-14.1.0
make
sudo make install

And if you would like to make it the default:

sudo update-alternatives --install /usr/bin/g++ g++ /usr/local/gcc-14.1.0/bin/g++-14.1.0 14
sudo update-alternatives --install /usr/bin/gcc gcc /usr/local/gcc-14.1.0/bin/gcc-14.1.0 14

After that, g++ showed I was running version 14.1.0. I was then able to compile my project that included some c++20/23 features that were not in the previous versions of g++ (chrono/format).

Answer from John Jones on askubuntu.com
🌐
Reddit
reddit.com › r/learnprogramming › is installing gcc on linux as complicated as i think it is?
r/learnprogramming on Reddit: Is installing GCC on Linux as complicated as I think it is?
June 14, 2017 - GCC and G++ are part of the GNU system (GCC stands for GNU C Compiler I'm pretty sure). Most people call GNU/Linux just "Linux" a lot of the time because almost all major distributions include the main GNU packages, but it's completely possible to have a Linux kernel without GNU or with just pieces of it. ... Depends on the distribution. Some include them as part of the base install, some don't.
🌐
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.
Discussions

c++ - Install gcc on linux with no root privilege - Stack Overflow
You need both the gcc-core and gcc-g++ to generate the c++ compiler (or the complete[=largest] package). The missing install-sh is in the gcc-core package. 2010-07-09T12:26:49.547Z+00:00 ... linuxfromscratch.org/lfs/view/stable may be useful for how-to get g++ building. More on stackoverflow.com
🌐 stackoverflow.com
installing gcc compiler
Hi all i’m new user to linux. i’ve installed suse11.0,but i’m not able to find the gcc compiler.i’ve also tried “sudo apt-get install build-essential” it says apt-get: command not found. Is there anywayto install gcc package More on forums.opensuse.org
🌐 forums.opensuse.org
0
0
January 9, 2009
Is installing GCC on Linux as complicated as I think it is?
GCC and G++ are part of the GNU system (GCC stands for GNU C Compiler I'm pretty sure). Most people call GNU/Linux just "Linux" a lot of the time because almost all major distributions include the main GNU packages, but it's completely possible to have a Linux kernel without GNU or with just pieces of it. ... Depends on the distribution. Some include them as part of the base install... More on reddit.com
🌐 r/learnprogramming
13
8
June 14, 2017
I can't install the GCC compiler recommended by Bro Code
Download from here and copy bin to path environment variable More on reddit.com
🌐 r/cprogramming
21
0
December 2, 2023
🌐
Ubuntu
documentation.ubuntu.com › ubuntu-for-developers › howto › gcc-setup
How to set up a development environment for GCC on Ubuntu - Ubuntu for Developers
3 weeks ago - This guide shows how to install GCC and related tooling, including a build system and debuggers, on Ubuntu Desktop. The GCC toolchain, including past versions and cross-compilers for different architectures, is included in the Ubuntu package repository. The gcc package provides the default version of GCC for your platform.
Top answer
1 of 5
20

I'm still on Ubuntu 22.04 LTS but needed g++14. The sudo apt-get gcc-14 did not work for me, as it installed clang++14 for some reason (perhaps a misconfiguration on my part). What did work for me was following the instructions I found at https://www.dedicatedcore.com/blog/install-gcc-compiler-ubuntu/

The steps I took:

sudo apt install build-essential
sudo apt install libmpfr-dev libgmp3-dev libmpc-dev -y
wget https://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.gz
tar -xf gcc-14.1.0.tar.gz
cd gcc-14.1.0
./configure -v --build=$(uname -m)-linux-gnu --host=$(uname -m)-linux-gnu --target=$(uname -m)-linux-gnu --prefix=/usr/local/gcc-14.1.0 --enable-checking=release --enable-languages=c,c++ --disable-multilib --program-suffix=-14.1.0
make
sudo make install

And if you would like to make it the default:

sudo update-alternatives --install /usr/bin/g++ g++ /usr/local/gcc-14.1.0/bin/g++-14.1.0 14
sudo update-alternatives --install /usr/bin/gcc gcc /usr/local/gcc-14.1.0/bin/gcc-14.1.0 14

After that, g++ showed I was running version 14.1.0. I was then able to compile my project that included some c++20/23 features that were not in the previous versions of g++ (chrono/format).

2 of 5
16

GCC-14 (and G++-14) is available in the Universe repository for Ubuntu 24.04, as evident in the Ubuntu Package archive.

It is equally evident that this package is not available for Ubuntu 22.04, so installing this on 22.04 will require some third-party interference, or you have to compile it yourself.

See here on how to enable the Universe repositories.

🌐
Medium
medium.com › @ihouelecaurcy › how-to-check-and-install-gcc-on-linux-complete-developer-guide-98697e2ab78f
How to Check and Install GCC on Linux: Complete Developer Guide | by Ihouele Caurcy | Medium
July 24, 2025 - Ultimate verification command: command -v gcc >/dev/null 2>&1 && echo "Ready to compile!" || echo "Install GCC first" ... Found this guide helpful? Follow me for more Linux development tips and tutorials. Have questions or suggestions?
🌐
GeeksforGeeks
geeksforgeeks.org › installation guide › how-to-install-gcc-compiler-on-linux
How to Install GCC Compiler on Linux? - GeeksforGeeks
July 23, 2025 - Command 2: Now we have to install the build-essential packages, which is also known as a meta-package, it contains the GCC compiler all the other essentials used to compile the software written in C and C++ language. ... It will take some time to install all the essential packages. Command 3: After the second command it will install GCC on your Linux, to verify it is installed correctly, check the version of the GCC.
Find elsewhere
🌐
openSUSE Forums
forums.opensuse.org › english › programming/scripting
installing gcc compiler - Programming/Scripting - openSUSE Forums
January 9, 2009 - Hi all i’m new user to linux. i’ve installed suse11.0,but i’m not able to find the gcc compiler.i’ve also tried “sudo apt-get install build-essential” it says apt-get: command not found. Is there anywayto install gcc …
🌐
ArchWiki
wiki.archlinux.org › title › GNU_Compiler_Collection
GNU Compiler Collection - ArchWiki
The GNU Compiler Collection (GCC) is part of the GNU toolchain and includes front ends for C and C++. Install the gcc package.
🌐
nixCraft
cyberciti.biz › nixcraft › howto › linux › ubuntu linux install gnu gcc compiler and development environment
Ubuntu Linux Install GNU GCC Compiler and Development Environment - nixCraft
August 11, 2025 - Open the terminal app and type the following apt command/apt-get command: $ sudo apt update $ sudo apt upgrade $ sudo apt install build-essential OR $ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install build-essential Sample outputs: ...
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to install gcc compiler on ubuntu
How to Install GCC Compiler on Ubuntu {3 Simple Methods}
February 20, 2025 - The build-essential package includes the GCC compiler and other utilities needed to build software. 3. Use the following command to check the GCC version: ... The GCC version in this example is 13.3.0. Use the GCC PPAs (Personal Package Archive) to streamline the installation process and install a specific GCC version (or multiple GCC versions):
🌐
Embarcadero
embarcadero.com › home › free tools › dev-c++
Dev-C++ Overview - Free Tools - Embarcadero
Embarcadero Dev-C++ is a new and improved fork (sponsored by Embarcadero) of Bloodshed Dev-C++ and Orwell Dev-C++. It is a full-featured Integrated Development Environment (IDE) and code editor for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as its compiler.
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › beginner questions
Installing gcc and g++ - Linux Mint Forums
March 23, 2019 - I get the same results with gcc. I've tried sudo apt-get install mediainfo mediainfo-gui open jdk-8-jre wget ffmpeg x264 x265 (to install java) This produces the following errors E: unable to locate package open. E:unable to locate package jdk-8-jre Please help, I am not normally interested in point & click stuff (GUI) . I normally drop to a terminal for all my Unix (now Linux...
🌐
GNU
gcc.gnu.org
GCC, the GNU Compiler Collection - GNU Project
The GNU Compiler Collection includes front ends for C, C++, Objective-C, Objective-C++, Fortran, Ada, Go, D, Modula-2, COBOL, Rust, and Algol 68 as well as libraries for these languages (libstdc++,...). GCC was originally written as the compiler for the GNU operating system.
🌐
AddictiveTips
addictivetips.com › home › how to install gcc on ubuntu
How to install GCC on Ubuntu
March 22, 2021 - GCC packages are gcc-7, gcc-8, gcc-9, and gcc-10. To install GCC version 7 on Ubuntu, install both the gcc-7 and g++-7 packages.
🌐
LinuxCapable
linuxcapable.com › home › linux mint › how to install gcc on linux mint 22 and 21
How to Install GCC on Linux Mint 22 and 21 - LinuxCapable
1 month ago - To install GCC on Linux Mint, the quickest path is sudo apt install build-essential, which brings in gcc, the g++ C++ compiler, make, and the headers most common C and C++ projects expect.
🌐
Visual Studio
visualstudio.microsoft.com › vs › features › cplusplus
C++ Compiler | Download C++ for Windows - Visual Studio IDE
2 weeks ago - Download free Visual Studio IDE to build cross-platform apps for Linux, iOS, Android, IoT, and Windows devices using latest, standards-compliant C and C++.
🌐
DataFlair
data-flair.training › blogs › install-c-on-linux
How to Install C - Learn to Install GCC Compiler for Ubuntu - DataFlair
July 3, 2019 - These are Steps to Install C using gcc compiler on linux (ubuntu) Operating system. This installtion process also guide you to write & run your first program
🌐
mingw-w64
mingw-w64.org › downloads
Pre-built Toolchains - mingw-w64
GCC-MCF provides standalone 7-Zip archives of complete toolchains, including mingw-w64 headers, libraries, compilers and linkers. With Homebrew, mingw-w64 headers, libraries, compilers and linkers can be installed with just brew install mingw-w64. LLVM-MinGW is a toolchain built with Clang, ...
🌐
Arm Learning
learn.arm.com › install-guides › gcc › native
Native compiler: Install Guide
These Linux distributions use dnf as the package manager. To install the most common development tools use the commands below. If the machine has sudo you can use it. sudo dnf update -y sudo dnf group install "development-tools" -y · If sudo is not available become root and omit the sudo. dnf update -y sudo dnf group install "development-tools" -y · GCC is open source and freely available for use. ... To compile ...