Saturday, November 16, 2024
Google search engine
HomeGuest BlogsHow to Install GCC on Ubuntu 22.04

How to Install GCC on Ubuntu 22.04

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.

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

Install GCC on Ubuntu 22.04 Terminal

Steps to install and use GCC in ubuntu 22.04 using terminal or command line:

  • 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, Open your terminal or command line and execute the following command into it 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

If you want to install the latest gcc version 12 in Ubuntu 22.04, so use the following command for that:

sudo apt install gcc-12

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

Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments