compiler
The GNU Compiler Collection (GCC) is a compiler that supports many programming languages including c
and c++. Its initial objective is to bootstrap the GNU operating system and the first version of GCC which at
that time only supports C programming language was released on 22 March 1987 authored by Richard
Stallman. Since then, there have been dozens releases. Now current version is GCC 6.3 released on
December 21, 2016.
The simplest usage is gcc
gcc example.c
You can also specify the executable name instead of using the default a.out.
gcc -o example example.c
We can also separate the process into compiling source files into object file and then linking the object files
into final executable files.
gcc -c example.c
gcc -o example example.o
The command gcc -c example.c will produce the object file example.o and
gcc -o example example.o will produce the executable file example from the object file.
Above examples only compile single source file example.c , we can also compile multiple files using gcc
like following examples. Suppose we have 2 files a.c and b.c .
gcc -o example a.c b.c
GNU Compiler Collection
History
Usage
Single Step
gcc -c a.c
gcc -c b.c
gcc -o example a.o b.o
We can also use gcc with flags.
gcc example.c -Wall -std=c99
The -Wall flag tells gcc to output all warnings which can be very useful for debugging.
The -std=c99 flag tells gcc to compile using standard C99 which is the newest standard for C
programming language.
It is open-source and free and supports many programming languages and computer architecture. The
machine code produced by GCC has high quality. It can produce target-independent code and relative easy
to add support for new target machine. It can produce reasonable diagnostic information for programmer. It
supports OpenMP which is a standard for multiprocessing programming. We can use GCC to compile
C/C++ code using OpenMP to executable that can run
parallelly in multiple CPU cores.
It is slower and use more memory than Clang which is another popular compiler. The design of GCC
makes its components less reusable.
There is an active open source community behind the GCC compiler and there are several releases for
newer version in each year. It is a standard compiler for linux system and has strong support from the
development community.
I personally want to use the GCC for following reason.
Compile to object files and then Link
Strength And Weakness
Strength
Weakness
Level Of Support
Choosing Reason
It is the default compiler in linux and most likely already installed. It is also available for Mac-os and
Windows.
It supports the features of the newest standard C99 and C++11.
The usage of GCC is simple. Several commands are enough for typical homework project.
Apart from compiling C and C++, GCC also supports languages such as Java , Go and
Objective-c .
C_C++ compilers.pdf
https://en.wikipedia.org/wiki/GNUCompilerCollection
https://gcc.gnu.org/wiki/History
https://en.wikipedia.org/wiki/OpenMP
Availability
Support for new Standard
Easy to Use
Support for many other languages
Reference