How to Install GCC on Ubuntu 22.04?

Jul 07, 2022 . Admin

Hi Guys

Today, I would like to show you How to Install GCC on Ubuntu 22.04?. you can see Do I Install GCC on Ubuntu 22.04?. you'll learn Install GCC Manually in Ubuntu 22.04?. step by step explain Install New GCC on Ubuntu 22.04?.

You can use this post for ubuntu 14.04, ubuntu 16.04, ubuntu 18.4, ubuntu 20.04, ubuntu 21 and ubuntu 22.04 versions.

(1). Update System Dependencies

(2). Install GCC

(3). Verify GCC Installation

(4). Create a C program in Run In GCC

Step 1: Update System Dependencies

Run the following command on a 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.

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 command will generate a binary file named "helloworld" in the same directory. :


C program was executed successfully.