GNU Compiler Collection: Difference between revisions
m (Spelling/grammar/aesthetics) |
m (Replaced encyclopedic tag) |
||
Line 1: | Line 1: | ||
[[Category:Encyclopedia]]The '''GNU Compiler Collection''', or '''GCC''', is a multi-language compiler supporting multiple target architectures. As of version 4.1, the main branch includes support for [[Ada]], [[C]], [[C++]], [[Fortran]], [[Java]], [[Objective-C]], and [[Objective-C++]]. Support for other languages is possible through the creation of a compiler front-end. |
|||
==Basic Usage== |
==Basic Usage== |
Revision as of 04:14, 22 January 2008
The GNU Compiler Collection, or GCC, is a multi-language compiler supporting multiple target architectures. As of version 4.1, the main branch includes support for Ada, C, C++, Fortran, Java, Objective-C, and Objective-C++. Support for other languages is possible through the creation of a compiler front-end.
Basic Usage
Any of GCC's supported languages may be compiled through the simple command-line construct:
gcc (source-file)
However, some languages depend on the linking of libraries, such as C++'s Standard Template Library, to reach their full potential. In GCC, one way to include the STL is to change the way the compiler is called:
g++ (source-file)
In the above two examples, GCC will produce a binary file named a.out, barring any compile-time errors. This is the executable form of the code compiled. If it is preferable to have a binary of a different name, and it usually is, one can use the -o command-line option:
gcc (source-file) -o mybinary
or
g++ (source-file) -o mybinary
These example behaves the same as their sibling examples, with the exception that they create a binary named mybinary instead of a.out.