Compiling C under linux/UNIX

April 2018

Under linux, the C compiler is gcc. It is set as default under several distributions but not on Debian. You should install it:aptitude install gcc
Gcc is the acronym for GNU compiler collection created by the GNU project. This is a collection of integrated software capable of compiling various programming languages including C, C + +, Objective-C, Java, Ada and Fortran. It is used for the enhancement of all freeware. Linux OS depend directly of the GCC function.

The abbreviation GCC is used for three different entities:
  • 1. The complete collection of compilers;
  • 2. Part common to all compilers;
  • 3. the C compiler itself.

To refer specifically to the compilers of each language, it refers as:
  • GCC for C
  • G++ for C++
  • GCJ for Java
  • GNAT for Ada
  • Gfortran for Fortran
  • GPC for Pascal
  • GHDL for VHDL

GCC also has a tool for debugging, GNU Debugger (gdb). Although not part of GCC, Valgrind is preferred for more in depth testing, particularly to search for memory leaks.

GNU Debugger (gdb) is the debugging tool for GNU. However despite that Valgrind is not compiled with GCC, it is the most commonly used for serious troubleshoot.
Below are the two main commands of gcc for c :
  • $ gcc mysource.c # ==> creates executable a.out to be launched with../a.out.
  • $ Gcc-o-<name_of_program> c <mysource>. c # ==> The argument o-enables you to choose the name of the executable that will emerge from this compilation.
Published by jak58. Latest update on April 23, 2010 at 07:09 AM by jak58.
This document, titled "Compiling C under linux/UNIX," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (
Secure your PHP code
Unable to load dynamic library '/usr/lib/php4/20020429/