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
🌐
GNU
gcc.gnu.org › gcc-14
GCC 14 Release Series - GNU Project
To obtain GCC please use our mirror sites or our version control system.
🌐
SourceForge
sourceforge.net › projects › gcc-win64
gcc-win64 download | SourceForge.net
Download gcc-win64 for free. x64 build of GCC for Windows. x64 C/C++ compiler for Windows using (unofficial build): - gmp - mpfr - mpc - isl - cloog - mingw-w64 - gcc - seh You need at least core2 command set support to run this application. Note that every version with bundled gdb needs at ...
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
15

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.

🌐
Debian
packages.debian.org › sid › gcc-14
Debian -- Details of package gcc-14 in sid
dep: gcc-14-aarch64-linux-gnu (= 14.3.0-12) [arm64] GNU C compiler for the aarch64-linux-gnu architecture · dep: gcc-14-alpha-linux-gnu (= 14.3.0-12) [alpha] GNU C compiler for the alpha-linux-gnu architecture · dep: gcc-14-arm-linux-gnueabihf (= 14.3.0-12) [armhf] GNU C compiler for the arm-linux-gnueabihf architecture ·
🌐
GNU
gcc.gnu.org › install › download.html
Downloading GCC - GNU Project
The source distribution includes ... (GCC 13 and later) and Algol 68 (GCC 16 and later, experimental) compilers, as well as runtime libraries for C++, Objective-C, COBOL, Fortran and Algol 68. For previous versions these were downloadable as separate components such as the core ...
🌐
Baeldung
baeldung.com › home › installation › how to install the latest version of gcc on ubuntu
How to Install the Latest Version of GCC on Ubuntu | Baeldung on Linux
November 17, 2024 - To begin with, let’s utilize the wget command to download the source code as a .tar archive from the official GCC website: $ wget http://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.gz
🌐
SourceForge
sourceforge.net › home › open source software › software development › build tools › gcc-win64
Download gcc-14.1.0-no-debug.7z (gcc-win64)
build-FreshGCC-OldMinGW-w64 Automatic build of fresher gcc compiler and older MinGW-w64. There are various kinds of build of GCC. For example, GCC 14.1.0 is built with shared option enabled, and some are static versions. 1 Review Downloads: 2 This Week Last Update: 2024-06-23
Find elsewhere
🌐
GNU
gcc.gnu.org › gcc-14 › changes.html
GCC 14 Release Series — Changes, New Features, and Fixes - GNU Project
C++ module scanning for named modules is now available, based on the format described in P1689R5, Format for describing dependencies of source files. The -fdeps-format=, -fdeps-file=, and -fdeps-target= flags may be used to generate dependency information. In GCC 14 p1689r5 is the only valid ...
🌐
SourceForge
sourceforge.net › home › open source software › software development › build tools › gcc-win64
Download gcc-14.2.0-no-debug.7z (gcc-win64)
build-FreshGCC-OldMinGW-w64 Automatic build of fresher gcc compiler and older MinGW-w64. There are various kinds of build of GCC. For example, GCC 14.1.0 is built with shared option enabled, and some are static versions. 1 Review Downloads: 25 This Week Last Update: 2024-06-23
🌐
Debian
packages.debian.org › sid › libs › gcc-14-base
Debian -- Details of package gcc-14-base in sid
Este paquete contiene los archivos comunes a todos los lenguajes y bibliotecas contenidos en la recopilación del compilador de GNU (GCC).
🌐
GNU
ftp.gnu.org › gnu › gcc › gcc-14.2.0
Index of /gnu/gcc/gcc-14.2.0
Index of /gnu/gcc/gcc-14.2.0 · Apache/2.4.52 (Trisquel_GNU/Linux) Server at ftp.gnu.org Port 443
🌐
SourceForge
sourceforge.net › home › open source software › software development › build tools › gcc-win64 › files
gcc-win64 - Browse /14.1.0 at SourceForge.net
Download Latest Version gcc-15.2.0-gdb-16.3.90.20250511-binutils-2.45-mingw-w64-v13.0.0-ucrt.7z (81.8 MB) Home / 14.1.0 · Other Useful Business Software · AI-generated apps that pass security review · Stop waiting on engineering. Build production-ready internal tools with AI—on your company ...
🌐
DEV Community
dev.to › marcosplusplus › how-to-install-gcc-14-and-use-c23-41od
How to Install GCC 14 and Use C++23 - DEV Community
April 15, 2025 - g++ --version g++ (Ubuntu 14.2.0-4ubuntu2~24.04) 14.2.0 Copyright (C) 2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions.
🌐
SourceForge
sourceforge.net › home › open source software › software development › compilers › winlibs_mingw
Download GCC 14.1.0 (POSIX threads) + MinGW-w64 11.0.1 UCRT (release 1) source code.tar.gz (winlibs_mingw)
Windows version of the free open source GCC (GNU Compiler Collection) compiler for C and C++ (and other languages like Objective-C, Fortran, D). This is a standalone personal build, which means this download offers a complete compiler environment for Windows.
🌐
SUSE
documentation.suse.com › sbp › devel-tools › html › SBP-GCC-14 › index.html
Advanced Optimization and New Capabilities of GCC 14 | SUSE Linux Enterprise Server 15 SP6
February 16, 2025 - The document at hand provides an overview of GCC 14.2 as the current Development Tools Module compiler in SUSE Linux Enterprise 15 SP6. It focuses on the important optimization levels and options Link Time Optimization (LTO) and Profile Guided Optimization (PGO).
🌐
Debian
packages.debian.org › trixie › gcc-14-x86-64-linux-gnu
Debian -- Details of package gcc-14-x86-64-linux-gnu in trixie
dep: cpp-14-x86-64-linux-gnu (= 14.2.0-19cross1) [not amd64] dep: gcc-14-base (= 14.2.0-19) [amd64] GCC , la colección de compiladores de GNU (paquete base) dep: gcc-14-x86-64-linux-gnu-base (= 14.2.0-19cross1) [not amd64] GCC , la colección de compiladores de GNU (paquete base) dep: libc6 (>= 2.38) Biblioteca de C de GNU: Bibliotecas compartidas also a virtual package provided by libc6-udeb ·
🌐
Homebrew
formulae.brew.sh › formula › gcc@14
gcc@14 — Homebrew Formulae
brew install gcc@14 · GNU compiler collection · https://gcc.gnu.org/ License: GPL-3.0-or-later WITH GCC-exception-3.1 · Development: Pull requests · Formula JSON API: /api/formula/gcc@14.json · Formula code: gcc@14.rb on GitHub ·
🌐
Red Hat
developers.redhat.com › articles › 2024 › 05 › 15 › new-c-features-gcc-14
New C++ features in GCC 14 | Red Hat Developer
December 12, 2024 - The next major version of the GNU Compiler Collection (GCC), 14.1, was released on May 7 2024. Like every major GCC release, this version brings many additions, improvements, bug fixes, and new features.
🌐
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 - Learn how to install GCC on Ubuntu using 3 different methods. This well-structured guide is ideal for all levels of expertise.