Contents|Index|Previous|Next
gcc, the GNU compiler


gcc invokes all the necessary GNU compiler passes for you with the following utilities. There are several  machine-independent compiler switches, among which are, notably, -fno-exceptions (for C++), -fritti (for C++) and -T (for linking).
You have four implicit file extensions: .c, .C, .s, and .S. For more information, see Using GNU CC  in GNUPro Compiler Tools.
When you compile C or C++ programs with GNU C, the compiler quietly inserts a call at the beginning of main to a GCC support subroutine called __main. Normally this is invisible—you may run into it if you want to avoid linking to the standard libraries, by specifying the compiler option, -nostdlib. Include -lgcc at the end of your compiler command line to resolve this reference. This links with the compiler support library libgcc.a. Putting it at the end of your command line ensures that you have a chance to link first with any of your own special libraries.

__main is the initialization routine for C++ constructors. Because GNU C is designed to interoperate with GNU C++, even C programs must have this call: otherwise C++ object files linked with a C main might fail.

For more information on the compiler, see Using GNU CC in GNUPro Compiler Tools.



Top|Contents|Index|Previous|Next