How to Install GCC on Ubuntu 22.04

How to Install GCC on Ubuntu 22.04

Install and use GCC on ubuntu 22.04 system; Through this tutorial, we will learn how to install and Use GCC compiler on Linux ubuntu 22.04 system.

GCC can be used to compile many programming languages such as C, Objective C, C++, D, Go, Ada, and Fortran. This software is completely free and was originally developed by Free Software Foundation aka FSF.

How to Install GCC on Ubuntu 22.04

Use the following steps to install GCC on the ubuntu 22.04 system:

  • Step 1 – Update System Dependencies
  • Step 2 – Install GCC
  • Step 3 – Verify GCC Installation
  • Step 4 – Create a C program in Run In GCC

Step 1 – Update System Dependencies

First of all, execute the following command on command line or terminal to update system dependencies:

sudo apt update

Step 2 – Install GCC

Then install gcc in ubuntu system using the following command:

sudo apt install build-essential

Step 3 – Verify GCC Installation

Use the following command on command line to verify gcc installation on ubuntu system:

gcc --version

Step 4 – Create a C program in Run In GCC

Once the gcc installation has been done, Then create a simple hello world C program in nano editor and saved the file as helloworld.c.

#include <stdio.h>
int main() {
   // printf() displays the string inside quotation
   printf("Hello, World!");
   return 0;
}

Save this file and convert this into an executable one.

gcc -o helloworld helloworld.c

The above given command will generate a binary file by the name “helloworld” in the same directory. Execute the program using the following command on command line:

./helloworld

The C program was executed successfully.

Conclusion

Through this tutorial, we have learned how to install and Use the GCC compiler on Linux ubuntu 22.04 system.

Recommended Linux Ubuntu Tutorials

AuthorAdmin

My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of Tutsmake.com. I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published.