Linux

Guide to Learn GCC Installation on Ubuntu

GCC, an acronym standing for GNU Compiler Collection, is a collection of compilers for programming languages including Java, C, and C++. In this guide, we will show you how to install GCC compilers and related tools in Ubuntu and Debian

Install GCC Compiler using apt

The first step in installing GCC compiler is to update and upgrade the system. This can be done in a single command on the terminal as shown

Next, install the build-essential package. The build-essential package contains a collection of packages which are considered crucial for building Ubuntu packages. This includes the GCC compiler, make and other essential tools.

To install the build-essential package run

Sample Output

Verifying Installation

To verify that you have installed gcc and make run the command below

Output

Alternatively, you can run

Output

To get the version of make run

OR

Output

Next, we are going to install the dev man pages on Ubuntu/Debian distributions

Installation of dev man pages

To install the dev man pages run the following command

Sample Output

To view library calls, run the following commands

Output

install GCC compilers

Output

install GCC compilers

Output

install GCC compilers

Now that we have confirmed successful installation of the compilers and main components, let’s test the GNU GCC compiler

Testing the GCC compiler

Let’s first create a simple C++ program

Add the following code

Next, compile the code as follows

Be sure to find a file called test in your directory using the ls command.

Output

install gcc compiler

Finally, run it as shown

Output

And that’s it! We have successfully installed, tested and verified that our GCC compiler is working! Thank you for taking time in this tutorial on how to install GCC compilers on Ubuntu. Feel free to share on your social media handles.  Your feedback is very welcome.

Show More

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Close