5.1.3 Input File Types
The compilation driver recognizes the following file extensions, which are case sensitive.
Extensions | Definition |
---|---|
file.c |
A C source file that must be preprocessed. |
file.cpp |
A C++ source file that must be preprocessed. |
file.h |
A header file (not to be compiled or linked). |
file.i |
A C source file that has already been pre-processed. |
file.o |
An object file. |
file.ii |
A C++ source file that has already been pre-processed. |
file.s |
An assembly language source file. |
file.S |
An assembly language source file that must be preprocessed. |
other | A file to be passed to the linker. |
There are no compiler restrictions imposed on the names of source files, but be aware of case, name-length and other restrictions imposed by your operating system. If you are using an IDE, avoid assembly source files whose base name is the same as the base name of any project in which the file is used. This may result in the source file being overwritten by a temporary file during the build process.
The terms “source file” and “module” are often used when talking about computer programs. They are often used interchangeably, but they refer to the source code at different points in the compilation sequence.
A source file is a file that contains all or part of a program. They may contain C/C++ code, as well as preprocessor directives and commands. Source files are initially passed to the preprocessor by the driver.
A module is the output of the preprocessor, for a given source file, after inclusion of any header files (or other source files) which are specified by #include preprocessor directives. All preprocessor directives and commands (with the possible exception of some commands for debugging) have been removed from these files. These modules are then passed to the remainder of the compiler applications. Thus, a module may be the amalgamation of several source and header files. A module is also often referred to as a translation unit. These terms can also be applied to assembly files, as they too can include other header and source files.