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
🌐
Ubuntu
documentation.ubuntu.com › ubuntu-for-developers › howto › gcc-setup
How to set up a development environment for GCC on Ubuntu - Ubuntu for Developers
1 week ago - This guide shows how to install GCC and related tooling, including a build system and debuggers, on Ubuntu Desktop.
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.

Discussions

Is installing GCC on Linux as complicated as I think it is?
sudo apt install gcc More on reddit.com
🌐 r/learnprogramming
13
8
June 14, 2017
Ubuntu 24.04 and VirtualBox
Just tried on 7.0.18, now is fixed More on reddit.com
🌐 r/Ubuntu
8
6
April 27, 2024
How can I run windows.h crap in Linux
Why would you need windows.h to learn C++? That header contains windows-specific stuff, which you need (only) when you want to do C++ programming *specifically for windows*. If that is what you want, get a windows machine. If not, remove the include, and if that gives you problems solve those, or abandon the example because it is windows-specific. More on reddit.com
🌐 r/cpp_questions
4
3
November 6, 2020
Install Native Emacs Instructions

Native emacs is perfectly usable. I am not sure how easy is to get it going on Windows, some people have done it, but on *nix side it should be fairly easy. One important thing is to have libgccjit match gcc version (major version), otherwise one gets errors at compile time. Happened to me. I am on Arch Linux, I update daily, so everything is bleeding edge. Both gcc and libgccjit are what is found in latest repos official and libgccjit is in Aur. Native build is perfectly usable, I use it on everyday basis, compiled with -O3 flag.

Here is my config:

./configure --with-nativecomp --with-gnutls --without-gconf --with-rsvg --with-x --with-xwidgets --without-toolkit-scroll-bars --without-xaw3d --without-gsettings --with-mailutils --enable-locallisppath=~/.emacs.d/lisp CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer"

I percieve noticable difference, especially with Helm, but I haven't benchmarked anything, might be just my subjective impression.

More on reddit.com
🌐 r/emacs
16
10
May 12, 2020
🌐
Ubuntu
documentation.ubuntu.com › ubuntu-for-developers › tutorials › gcc-use
Develop with GCC on Ubuntu - Ubuntu for Developers
1 week ago - This tutorial shows how to build and debug C programs on Ubuntu using GCC and GDB. For instructions on installing GCC and related tooling (including IDEs, debuggers, and the build system), see the dedicated guide on How to set up a development environment for GCC on Ubuntu.
🌐
Ubuntu
documentation.ubuntu.com › ubuntu-for-developers › reference › availability › gcc
Available GCC versions - Ubuntu for Developers
April 5, 2026 - Installing Ubuntu Desktop for developers · Using Git version control on Ubuntu · Packaging software · Introduction to the .NET toolchain · Debugging with .NET · GraalVM native compilation · Contribute documentation · Back to top · Contribute to this page · This page lists GCC versions available in Ubuntu releases.
🌐
GitHub
gist.github.com › zuyu › 7d5682a5c75282c596449758d21db5ed
Install gcc 6 on Ubuntu · GitHub
sudo apt update 4.sudo apt-get install gcc-6 g++-6 -y ... vim is just a text editor. You can whether install it using sudo apt install vim or use another one, as nano. ... Hi, This has been useful for me, so I'll chip in.
🌐
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 - # Release build gcc -O2 -DNDEBUG program.c -o program# Check supported optimizations gcc --help=optimizers · # Install specific versions (Ubuntu) sudo apt install gcc-9 gcc-10 gcc-11
Find elsewhere
🌐
Snapcraft
snapcraft.io
Snapcraft - Snaps are universal Linux packages
Snaps are containerised software packages that are simple to create and install. They auto-update and are safe to run. And because they bundle their dependencies, they work on all major Linux systems without modification.
🌐
LinuxShout
linux.how2shout.com › home › how to install gcc in ubuntu via terminal or running on virtualbox
How to Install GCC in Ubuntu via Terminal or running on VirtualBox - LinuxShout
February 24, 2025 - This tutorial will show you Ubuntu’s complete GCC installation process, regardless of your Linux version. You can be using Ubuntu 24.04, 22.04, or any other. Once we finish the installation steps, we will also check how to verify our installation, troubleshoot common issues, and even explore its basic usage.
🌐
Greenwebpage
greenwebpage.com › home › blog › how to install gcc compiler on linux
How to Install GCC Compiler on Linux - Greenwebpage Community
July 4, 2024 - The GCC compiler can be easily installed on any Linux distribution, including the Ubuntu 24.04 system. On Ubuntu, you can use the “sudo apt install build-essential -y” or “sudo apt install gcc -y” to install the GCC compiler.
🌐
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 -

Disclaimer: I am not well versed at Linux at all. Please pardon my ignorance.

I'm trying to figure out how to install GCC onto my macbook running Ubuntu 16.04. However after reading through the 6 steps to install GCC outlined on the GCC website I am at a total loss. I understand maybe 50% of the words on these pages. There are so many prerequisites and so many software requirements and so many technical things you have to set up that there is basically no hope in me figuring this out unless I extensively google every other word within the instructions. I would like to install it myself without the use of some sort of installer, but if it's this complicated to do so then I may have quite a bit of googling to do.

My question is this. What are the general guidelines I need to know to install GCC on Linux? I'm not asking for a "step-by-step how-to" guide. I'd just like a general overview on how one goes about installing GCC on their own. I understand I need some required software installed, I need to check and see if my physical CPU is compatible (real confusing), I need figure out in what directory I want to install GCC in, I need to figure out how to build GCC (this is real confusing) and I need to figure out a whole lotta stuff that I don't even know about yet. Perhaps it isn't as hard as it seems. Maybe this way of installing GCC is hard mode that nobody does. Or maybe this is the standard way that everyone uses. I don't know and would greatly appreciate any help or advice you all may have. Thanks!

🌐
Namehero
namehero.com › blog › how-to-install-gcc-on-ubuntu
How To Install GCC On Ubuntu
November 4, 2024 - Press Ctrl+Alt+T on your keyboard to open the Ubuntu terminal. This is where we’ll run the installation commands. ... Before we install GCC, let’s ensure that our package lists are up to date.
🌐
LinuxConfig
linuxconfig.org › home › how to install gcc the c compiler on ubuntu 20.04 lts focal fossa linux
How to install GCC the C compiler on Ubuntu 20.04 LTS Focal Fossa Linux
September 21, 2025 - Although you can install the C compiler separately by installation of the gcc package, the recommended way to install the C compiler on Ubuntu 20.04 is by installation of the entire development package build-essential.
🌐
Arm Developer
developer.arm.com › downloads › - › arm-gnu-toolchain-downloads
Arm GNU Toolchain Downloads – Arm Developer
Arm recommends restricting write access, to any custom installation location, to only the users who are allowed to run the installer. aarch64_be-none-linux-gnu-gdb and aarch64_be-none-linux-gnu-gdb-py on Linux hosts requires liblzma.so.5. Toolchains dedicated for Windows host require mingw-w64 library, a complete runtime environment for GCC.
🌐
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 - This guide shows how to install GCC on Ubuntu and start compiling code on your system in no time.
🌐
Scribd
scribd.com › document › 583740300 › How-to-Install-GCC-build-essential-on-Ubuntu-20-04-Linuxize
How To Install GCC (Build-Essential) On Ubuntu 20.04
JavaScript is disabled in your browser · Please enable JavaScript to proceed · A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser
🌐
Ubuntu
documentation.ubuntu.com › release-notes › 26.04 › summary-for-lts-users
Ubuntu 26.04 LTS summary - Ubuntu release notes
5 days ago - GCC 🐄 has been updated from version 14 to 15.2, binutils from 2.42 to 2.46, and glibc from 2.39 to 2.43.
🌐
Cygwin
cygwin.com
Cygwin
Use the setup program to perform a fresh install or to update an existing installation.
🌐
mingw-w64
mingw-w64.org
mingw-w64
A complete runtime environment for GCC & LLVM for 32-bit (x86), 64-bit (x64), and ARM64 Windows
🌐
CredibleDEV
credibledev.com › posts › install gcc on ubuntu linux
Install GCC on Ubuntu Linux | credibleDEV
February 3, 2023 - One of the most common ways to install GCC on Ubuntu is through the “build-essential” package in APT.
🌐
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.