Home / General programming / C / How to install C compiler in ubuntu ( gcc compiler )

How to install C compiler in ubuntu ( gcc compiler )

Installing gcc compiler in Ubuntu Operating system.

gcc compiler
gcc compiler

gcc compiler is one of the best of compilers to compile c,c++ programming language , you can use it with windows and Linux.

in this topic we will learn toghather how to install gcc compiler on ubuntu and how to use it.

so The GNU Compiler Collection (GCC) is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain and the standard compiler for most Unix-like Operating Systems. The Free Software Foundation (FSF) distributes GCC under the GNU General Public License (GNU GPL). GCC has played an important role in the growth of free software, as both a tool and an example.
(source:https://en.wikipedia.org/wiki/GNU_Compiler_Collection)

how to start :

1-Open you terminal program
To open your terminal click on Ctrl+Alt+t

2-You have to write installation command:

sudo apt-get install build-essential

This command will install all the required packages for C and C++ compilers.

Now you are ready to use it, how how you can use the compiler ?

First let write hello world code for testing:

#include <stdio.h>
int main()
{
printf("Hello ,World /n");
return 0;
}

Now please open your terminal , (Ctrl + Alt + T) , and write gedit

Copy the code and save it in your Desktop like(unhandlederror.c)

P.S don’t forget to save it with (.c)

Then open the terminal again (Ctrl + Alt + T) and open your desktop inside the terminal.

Now we have to compile your program :

g++ main.cpp -o main

It should give you Hello world in your terminal 🙂

Unhandled error Team – with our love

One comment

  1. Great topic , thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *