How to install C compiler on ubuntu 20.04

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

GCC, the GNU Compiler Collection is a compiler system developed to support various programming languages. It is a standard compiler used in most projects related to GNU and Linux, for example, Linux kernel. The objective of this tutorial is to install GCC the C compiler on Ubuntu 20.04 LTS Focal Fossa Linux. This will be achieved by using the apt install command.

Step 1: Install C compiler by installation of the development package build-essential use the following command.

 sudo apt install build-essential

Step 2: Check C compiler version using following commnad 
 gcc --version 
output
gcc (Ubuntu 9.2.1-17ubuntu1) 9.2.1 20191102

Step 3: Create a basic C code source. For example let's create hello world C program. Save the following code as hello.c text file
#include <stdio.h> 
int main() 
{    
printf("Hello, World!");    
return 0; 
}

Step 4: Compile and execute the hello.c C code:
$ gcc -o hello hello.c  
$ ./hello  
Hello, World!

Thanks for reading!!! if you have any question ask in a comment.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Mel
Melhttps://unixcop.com
Unix/Linux Guru and FOSS supporter

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook