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 -

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!

🌐
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
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
How to install avr-gcc 10.1.0 in Ubuntu?
I can only get 5.4.0 installing avr-gcc with sudo apt-get install. I've downloaded avr-gcc-10.1.0-x64-linux.tar.bz2 from here: https://blog.zakkemble.net/avr-gcc-builds/ but have no idea how to make my system actually use it. I'm a pretty new Linux user and suspect that this might be a fairly basic thing but can't find any information... More on reddit.com
🌐 r/avr
5
7
September 17, 2020
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.

🌐
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 - sudo dnf install gcc # Or install complete development tools sudo dnf groupinstall "Development Tools" ... # Check system headers ls /usr/include/stdio.h >/dev/null 2>&1 && \ echo "✅ Headers present" || \ echo "❌ Headers missing" # Debian/Ubuntu ...
🌐
GitHub
gist.github.com › application2000 › 73fd6f4bf1be6600a2cf9f56315a2d91
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04) · GitHub
It worked like charm in difficult setup. ... 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
Find elsewhere
🌐
Red Hat
developers.redhat.com › articles › 2023 › 11 › 10 › install-gcc-and-build-hello-world-application-rhel-9
Install GCC and build a Hello World application on RHEL 9 | Red Hat Developer
November 10, 2023 - Red Hat Enterprise Linux provides a comprehensive set of tools for developing C and C++ applications. Download and install the development tools package group, which includes GNU Compiler Collection (GCC), GNU Debugger (GDB), and other development tools:
🌐
nixCraft
cyberciti.biz › nixcraft › howto › gnu c / c++ › where is my linux gnu c or gcc compilers are installed?
Where is My Linux GNU C or GCC Compilers Are Installed? - nixCraft
January 7, 2021 - You need to use the up2date command or yum command or apt-get command/apt command to install GNI C/C++ (gcc) and required libs as per your Linux distro. Note: You must login as root using su - or sudo -s command and then use command as per your ...
🌐
Medium
medium.com › @iemkamran › how-to-install-gcc-on-ubuntu-22-04-c50a5d796ee1
How to install GCC on ubuntu 22.04 | by iemkamran | Medium
November 30, 2022 - How to install GCC on ubuntu 22.04 The GNU Compiler or GCC Complier Collection includes front ends for C, C++, Objective-C, Fortran, Ada, Go, and D, as well as libraries for these languages …
🌐
iO Flood
ioflood.com › blog › install-gcc-command-linux
Installing and Using the GCC Command: Linux User Guide
January 2, 2024 - On RPM-based distributions, you can use sudo yum install glibc-devel. This error occurs when GCC can’t find the main function. In C, every program must have a main function as the entry point. gcc hello.c -o hello # Output: # '/usr/lib/gc...
🌐
Linux Mint Forums
forums.linuxmint.com › board index › main edition support › beginner questions
Installing gcc and g++ - Linux Mint Forums
March 23, 2019 - Hi kelowna_dave, Welcome to the wonderful world of Linux Mint and its excellent forum! I just read your post and the good replies to it. Here are my thoughts on this as well. It would help to know more about your system setup like which version of Cinnamon did you install. If you run "inxi -Fxzd" and "lsusb" from the console terminal prompt, highlight the results, copy and paste them back here, that should provide enough information.
🌐
Shapehost
shape.host › home › resources › debian 12: installing gcc compiler – detailed walkthrough
Debian 12: Installing GCC Compiler - Detailed Walkthrough - Shapehost
December 5, 2023 - ‍GNU Compiler Collection (GCC) is a powerful compiler system designed to support a wide range of programming languages. It is the standard compiler for many GNU and Linux projects, including the Linux kernel. In this guide, we will walk you through the process of installing GCC on Debian 12, ensuring that you have all the tools needed to compile and run your programs smoothly.
🌐
LinuxConfig
linuxconfig.org › home › how to install gcc the c compiler on ubuntu 18.04 bionic beaver linux
How to install GCC the C compiler on Ubuntu 18.04 Bionic Beaver Linux
September 22, 2025 - The following linux command will install gcc compiler on on Ubuntu 18.04 Bionic Beaver. Open up terminal and enter: ... Another way to install gcc compiler is to install it as part of build-essential package. build-essential package will also install additional libraries as well as g++ compiler. ...
🌐
MontaVista Software.
mvista.com › en
MontaVista Software- Commercial Embedded Linux Solutions
Built on the Yocto Project 5.0 LTS and the Linux kernel 6.6 LTS, MontaVista CGX 5.0 offers AI-ready and Secure-by-Design features in a single platform.
🌐
Espressif
docs.espressif.com › projects › esp-idf › en › stable › esp32 › get-started › index.html
Get Started - ESP32 - — ESP-IDF Programming Guide v6.0.1 documentation
Computer running Windows, Linux, or macOS. ... Currently, some of the development boards are using USB Type C connectors. Be sure you have the correct cable to connect your board! If you have one of ESP32 official development boards listed below, you can click on the link to learn more about the hardware. ... ESP-IDF that essentially contains API (software libraries and source code) for ESP32 and scripts to operate the Toolchain · To install ESP-IDF, build tools, and the toolchain, use the ESP-IDF Installation Manager (EIM) available for multiple operating systems.
🌐
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 …
🌐
Develop n Solve
developnsolve.com › linux › how-to-install-gcc-on-linux
How to Install GCC on Linux: Step-by-Step Guide
On Ubuntu and Debian-based Linux distributions, GCC can be installed using the apt package manager. Apt handles dependencies and downloads the necessary packages from official repositories. First, update your package lists to ensure you get the latest version available.
🌐
Rust
rustup.rs
rustup.rs - The Rust toolchain installer
Run the following in your terminal, then follow the onscreen instructions. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ... You appear to be running Unix. If not, display all supported installers.