A few words of thanks would be greatly appreciated.

Compiling C under linux/UNIX

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.

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
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 (ccm.net).