How to Install GCC and G++ Compiler on Ubuntu 26.04 LTS | C/C++ Setup @ProgrammingKnowledge
How to Install GCC and G++ Compiler on Ubuntu 26.04 LTS | C/C++ Setup  @ProgrammingKnowledge
Uploaded September 2026 | Updated November 2026, 1 week ago
# How to Install GCC and G++ Compiler on Ubuntu 26.04 LTS (Linux) | Complete Guide

In this complete beginner-friendly tutorial, you'll learn **how to install the GCC and G++ compilers on Ubuntu 26.04 LTS Linux**. GCC is the GNU Compiler Collection and provides the standard C compiler on Ubuntu, while G++ is the GNU C++ compiler. Ubuntu's official developer documentation recommends installing the `gcc` and `g++` packages through APT.

We'll also show you how to install the **Build Essential** package, which is often the easiest option when setting up a complete C/C++ development environment. On Ubuntu 26.04 LTS, `build-essential` depends on GCC, G++, the C development libraries, and `make`.

## What You'll Learn

In this tutorial, we'll cover:

* What is GCC?
* What is G++?
* GCC vs G++
* Why you need a C/C++ compiler
* Installing GCC on Ubuntu 26.04 LTS
* Installing G++ on Ubuntu 26.04 LTS
* Installing the `build-essential` package
* Checking GCC and G++ versions
* Creating your first C program
* Compiling a C program with GCC
* Creating your first C++ program
* Compiling a C++ program with G++
* Running compiled programs
* Understanding compiler errors
* Troubleshooting GCC/G++ installation problems

## Step 1: Open the Ubuntu Terminal

Start by opening the Terminal application.

You can use the keyboard shortcut:

## GCC vs G++

It's important to understand the difference:

| Compiler | Primary use |
| ----------------- | --------------------------------------- |
| `gcc` | C and GNU compiler collection |
| `g++` | C++ compilation |
| `make` | Automates compilation/build processes |
| `build-essential` | Installs the core development toolchain |

For a C program, you'll normally use:

```bash
gcc program.c -o program
```

For a C++ program:

```bash
g++ program.cpp -o program
```

## Step 10: Compile With Warnings

When developing software, it's a good idea to enable compiler warnings.

For C:

```bash
gcc -Wall -Wextra hello.c -o hello
```

For C++:

```bash
g++ -Wall -Wextra hello.cpp -o hello-cpp
```

Warnings can help identify potential problems in your code before they become bugs.

## Step 11: Check the Build Tool

If you installed `build-essential`, verify that `make` is available:

```bash
make --version
```

The `make` utility is commonly used by Linux projects to automate compiling and linking multiple source files.

## Troubleshooting Common Problems

### `gcc: command not found`

If you receive:

```text
gcc: command not found
```

install GCC:

```bash
sudo apt update
sudo apt install gcc
```

### `g++: command not found`

Install G++:

```bash
sudo apt update
sudo apt install g++
```

Or install the complete development toolchain:

```bash
sudo apt install build-essential
```

### APT cannot find the package

First refresh your package lists:

```bash
sudo apt update
```

Then try:

```bash
sudo apt install build-essential
```

If you're running Ubuntu 26.04 LTS, `build-essential` is available in the official Ubuntu repositories.

### Compilation errors

If GCC or G++ is installed but your program doesn't compile, the problem may be with the source code rather than the compiler installation.

Read the error message carefully and check:

* Missing headers
* Syntax errors
* Missing semicolons
* Incorrect function names
* Incorrect library references
* Incorrect compiler options

## Final Verification

You can quickly verify the complete environment with:

```bash
gcc --version
g++ --version
make --version
```

If all three commands return version information, your basic C/C++ development environment is ready.

By the end of this tutorial, you'll know **how to install GCC, G++, and Build Essential on Ubuntu 26.04 LTS, verify the installation, compile C and C++ programs, and run your first applications from the Linux Terminal**.

This setup provides a solid foundation for learning **C, C++, Linux programming, system programming, embedded development, competitive programming, and software development**.

If you found this tutorial helpful, don't forget to like the video, subscribe to the channel, and turn on notifications for more **Ubuntu, Linux, C, C++, programming, development tools, and technology tutorials**.

#GCC #GPlusPlus #GCCCompiler #GPlusPlusCompiler #Ubuntu #Ubuntu2604 #UbuntuLinux #CProgramming #CPlusPlus #Cpp #CProgrammingTutorial #CppTutorial #Linux #LinuxTutorial #BuildEssential #GNU #Compiler #Programming #SoftwareDevelopment #LearnC #LearnCpp #DeveloperTools #TechTutorial
How to Install GCC and G++ Compiler on Ubuntu 26.04 LTS | C/C++ SetupHow to Install and Use Trae AI Code Editor on Windows 11 | Cursor AlternativeHow To Install Anaconda Python, Jupyter Notebook And Spyder on Windows 11 (2026)How to Read a File Line by Line in Node.js | Process Large Text Files Efficiently TutorialHow to Install and Set Up DBeaver on Windows 11 (2026)AWK in Linux for Beginners 4 – AWK Fields & Records Explained ($1, $2,$NF, NR, NF)How to Install Next.js on Windows 11 | Create Next.js Project (2026)How to Run JavaScript Code in VS Code | Setup & Execute JS EasilyHow to Install Ollama on Ubuntu Linux | Use Ollama for Running AI Models Locally (2026)How to Easily Run Flutter App on a Physical DeviceHow to Enable SSH in Ubuntu Linux  | Install openssh-serverHow To Improve UI With The Help Of ChatGPT In 2026: Ultimate Web Design & Front-End Masterclass!
ProgrammingKnowledge |

How to Install GCC and G++ Compiler on Ubuntu 26.04 LTS | C/C++ Setup

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER