Saturday, August 8, 2009

How to Compile & Run C Program in Ubuntu Linux

well.... its a little bit tricky to compile C program in linux!!

Step 1:: First you have to put the source code in a file with extension .c
Step 2:: Open terminal & specify the path where you have save it.
Step 3:: Tell the gnome compiler to compile it by using gcc filename.c
Step 4:: To run the program type ./a.out

You will see the output of the program in terminal window.

If terminal fails to compile or run it make sure you have installed build-essential pack.
To get it connect your computer to Internet and put sudo aptitude install build-essential in terminal.
Still have problems..... write the source code properly.

No comments:

Post a Comment