The Wayback Machine - https://web.archive.org/web/20240218174542/https://www.geeksforgeeks.org/how-to-install-gcc-compiler-on-linux/
Open In App
Related Articles

How to Install GCC Compiler on Linux?

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

In this article, we will discuss how to install a GCC compiler on Linux. 

GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++. The GCC is an open-source collection of compilers and libraries.

Let’s start with the steps to install the GCC on Linux.

To install the GCC open the terminal on Linux.

The terminal takes the input from the user in the form of commands and displays the output on the screen. Hence we have to pass some commands to install the GCC.

Follow the commands step by step to install the GCC.

Command 1: The very first step is to update the packages. This command is used to download package information from all configured sources and to get the info of the updated versions of the packages.

sudo apt-get update
get updates first

command-1

Note: In the first command it will ask for your password, make sure to enter the password correctly.

Command 2: Now we have to install the build-essential packages, which is also known as a meta-package, it contains the GCC compiler all the other essentials used to compile the software written in C and C++ language.

sudo apt install build-essential
build the dependencies

command-2

It will take some time to install all the essential packages.

Command 3: After the second command it will install GCC on your Linux, to verify it is installed correctly, check the version of the GCC.

gcc --version
check gcc version

command-3

Now, we have successfully installed the GCC on Linux.

Note: Versions may vary from time to time.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!


Last Updated : 06 Oct, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads
Complete Tutorials