5.1.3 Input File Types
The xc32-gcc
driver distinguishes source
files, intermediate files and library files solely by the file type, or extension. The
following case-sensitive extensions, listed below are recognized.
Extension | File format |
---|---|
.c |
C source file |
.i |
Preprocessed C source file |
.cpp |
C++ source file |
.ii |
Preprocessed C++ source file |
.s |
Assembler source file |
.S |
Assembly source file requiring preprocessing |
.o |
Relocatable object code file |
.a |
Archive (library) file |
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 that are imposed by your host operating system.
Avoid using the same base name for assembly and C/C++ source files, even if they are located in different directories. So, for example, if a project contains a C source file called init.c, do not also add to the project an assembly source file with the name init.s. Avoid, also, having source files with the same base name as the MPLAB X IDE project name.
The terms source file and module 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. It may contain C/C++ code, as well as preprocessor directives and commands. Source files are initially passed to the preprocessor by the compiler driver.
A module is the output of the preprocessor for a given source file, after the inclusion of
any header files specified by#include
preprocessor directives, and after
the processing and subsequent removal of other preprocessor directives (with the possible
exception of some commands for debugging). Thus, a module is usually the amalgamation of a
source file and several header files, and it is this output that is passed to the remainder
of the compiler applications. A module is also referred to as a translation
unit.
Like assembly source files, these terms can also be applied to assembly files, which can be preprocessed and can include other header files.