GCC Section: GNU Tools (1) Updated: 1998/08/29 Index Return to Main Contents --------------------------------------------------------------------------------
NAME gcc, g++ - GNU PRoject C and C++ Compiler (egcs-1.1.2) SYNOPSIS gcc [ option filename ]... g++ [ option filename ]... WARNING The information in this man page is an extract from the full documentation of the GNU C compiler, and is limited to the meaning of the options. This man page is not kept up to date except when volunteers want to maintain it. If you find a discrepancy between the man page and the software, please check the Info file, which is the authoritative documentation.
If we find that the things in this man page that are out of date cause significant confusion or complaints, we will stop distributing the man page. The alternative, updating the man page when we update the Info file, is impossible because the rest of the work of maintaining GNU CC leaves us no time for that. The GNU project regards man pages as obsolete and should not let them take time away from other things.
For complete and current documentation, refer to the Info file `gcc' or the manual Using and Porting GNU CC (for version 2.0). Both are made from the Texinfo source file gcc.texinfo.
DESCRipTION The C and C++ compilers are integrated. Both process input files through one or more of four stages: preprocessing, compilation, assembly, and linking. Source filename suffixes identify the source language, but which name you use for the compiler governs default assumptions: gcc assumes preprocessed (.i) files are C and assumes C style linking. g++ assumes preprocessed (.i) files are C++ and assumes C++ style linking. Suffixes of source file names indicate the language and kind of processing to be done:
.c C source; preprocess, compile, assemble .C C++ source; preprocess, compile, assemble .cc C++ source; preprocess, compile, assemble .cxx C++ source; preprocess, compile, assemble .m Objective-C source; preprocess, compile, assemble .i preprocessed C; compile, assemble .ii preprocessed C++; compile, assemble .s Assembler source; assemble .S Assembler source; preprocess, assemble .h Preprocessor file; not usually named on command line
Files with other suffixes are passed to the linker. Common cases include:
.o Object file .a Archive file
Linking is always the last stage unless you use one of the -c, -S, or -E options to avoid it (or unless compilation errors stop the whole process). For the link stage, all .o files corresponding to source files, -l libraries, unrecognized filenames (including named .o object files and .a archives) are passed to the linker in command-line order.
OPTIONS Options must be separate: `-dr' is quite different from `-d -r '. Most `-f' and `-W' options have two contrary forms: -fname and -fno-name (or -Wname and -Wno-name). Only the non-default forms are shown here.
Here is a summary of all the options, grouped by type. EXPlanations are in the following sections.