Friday, January 18, 2013

How to compile C program in ubuntu using gcc

To compile your program using gcc compiler you need to download build essential library
so write on terminal

$sudo apt-get install build-essential

make a file called test.c

write a test C program

  • #include<stdio.h>
  • #include<stdlib.h>
  • int main()
  • {
  • printf("\nHello World\n\n");
  • return(0);
  • }

Save the program and go to the directory in which you have made your test.c

cd test.c


gcc -Wall -W -Werror test.c -o test



now your program is running.
IT Certification Category (English)640x480

Partner Sites

Top Online Courses From ProgrammingKnowledge

Python Course
Java Course
Bash Course
Linux Course
C Course
C++ Course
PHP Course
Android Course
C# Course
JavaFx Course
NodeJs Course
Jenkins Course
Scala Course
Bootstrap Course
MongoDB Course
QT C++ GUI Course