How to Install GCC Compiler on Ubuntu

GNU Compiler Collection (GCC) is a collection of compilers and libraries for C, C ++, Objective-C, Fortran, Ada, Go, and D programming languages. Many open source projects, including GNU tools and the Linux kernel, are compiled with GCC.

This tutorial covers the steps required to install the GCC compiler on Ubuntu. We will show you how to install the stable version of distribution and the latest version of GCC.

The same instructions apply for Ubuntu and any Ubuntu-based distribution, including Kubuntu, Linux Mint, and Elementary OS.

Prerequisites

In order to be able to add new repositories and install packages on your Ubuntu system, you must log in as root or user with sudo privileges.

GCC installation on Ubuntu

The default Ubuntu repositories contain a meta-package called build-essential that contains the GCC compiler and many libraries and other utilities needed to compile software.

Perform the steps below to install the GCC compiler Ubuntu:

  1. Start by updating the packages list:
sudo apt update

2. Install the build-essential package by typing:

sudo apt install build-essential

The command installs a bunch of new packages including gccg++ and make.

You may also want to install the manual pages about using GNU/Linux for development:

sudo apt-get install manpages-dev

3. To validate that the GCC compiler is successfully installed, use the gcc --version command which prints the GCC version:

gcc --version

That’s it. GCC is now installed on your system, and you can start using it.

Conclusion

You have successfully installed GCC on your Ubuntu. You can now visit the official GCC Documentation page and learn how to use GCC and G++ to compile your C and C++ programs.

Leave a Comment