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 commnadgcc --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 ashello.c
text file#include <stdio.h> int main() { printf("Hello, World!"); return 0; }
Step 4: Compile and execute thehello.c
C code:$ gcc -o hello hello.c $ ./hello Hello, World!
Thanks for reading!!! if you have any question ask in a comment.