gcc, g++—GNU project C and C++ Compiler (v2.7)
gcc [ option j filename ]. . .
g++ [ option j filename ]…
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.
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 filenames 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
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.