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.

Table 5-2. Input File Types
ExtensionFile format
.cC source file
.iPreprocessed C source file
.cppC++ source file
.iiPreprocessed C++ source file
.sAssembler source file
.SAssembly source file requiring preprocessing
.oRelocatable object code file
.aArchive (library) file
otherA 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 module is also referred to as a translation unit and is the preferred terminology, particularly when working with C++ languages since C++20.

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, or translation unit, 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.

This terminology also applies to assembly files, which can also be preprocessed and include other header files.