Ubuntu – How to run a single C source code on code:block or in geany

programming

I am new in Ubuntu. Now I am using ubuntu 12.04(lts). I want to run my C programming code (.c/.cpp). But I dont know how to compile and run code in ubuntu. SO i need help. Please tell me How can I run single .c code in ubuntu.

Best Answer

I assume there is terminal emulator widget in your geany (which is suggested by geany package). Click on it (In lower-left corner) and first navigate to folder in which is your source file:

cd Path/To/Source

To compile file YourSourceFile.c type:

gcc YourSourceFile.c -o ProgramName

To run the program type:

./ProgramName