The suffix attached to a file name appearing on the command line determines how the compiler processes the file. A file name with a suffix other than those listed in the following table, or without a suffix, is passed to the linker.
Table 2-1 File Name Suffixes Recognized by the C++ Compiler
Suffix |
Language |
Action |
---|---|---|
.c |
C++ |
Compile as C++ source files, put object files in current directory; default name of object file is that of the source but with an .o suffix. |
.C |
C++ |
Same action as .c suffix. |
.cc |
C++ |
Same action as .c suffix. |
.cpp |
C++ |
Same action as .c suffix. |
.cxx |
C++ |
Same action as .c suffix. |
.i |
C++ |
Preprocessor output file treated as C++ source file. Same acton as .C suffix. |
.s |
Assembler |
Assemble source files with the assembler. |
.S |
Assembler |
Assemble source files with both the C language preprocessor and the assembler. |
.il |
Inline expansion |
Process assembly inline-template files for inline expansion. The compiler will use templates to expand inline calls to selected routines. (Inline-template files are special assembler files. See the inline(1) man page.) |
.o |
Object files |
Pass object files through to the linker. |
.a |
Static (archive) library |
Pass object library names to the linker. |
.so .so.n |
Dynamic (shared) library |
Pass names of shared objects to the linker. |