Install C on Ubuntu.
Hi guys in this post I am gonna tell you how to install C compiler on Ubuntu.
Step 1: Update your OS.
sudo apt-get update
Step 2: In order to install C compiler we need to install build-essential package. This package consist tools to build packages for Ubuntu.
sudo apt-get install build-essential
Step 3: Check configurations to make sure that compiler is installed run the following commands.
gcc -v
make -v
Step 4: Testing installation by creating and compiling a simple program to print "Hello World!!".
mkdir ~/C && cd ~/C
touch hello.c && vim hello.c
To exit VIM editor type: press esc then write :wq hit enter
Step 5: Compile the program.
cc hello.c -o hello
Above command will generate a file with name hello. You can see the files in the terminal with command 'ls'.Step 6: Run the C program.
To run c program write: ./hello
OUTPUT: Hello World!!
UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity. ~Dennis Ritchie
No comments:
Post a Comment