The compiler driver uses file extensions to distinguish the language the source file is written in. The compiler driver recognizes the extension .c as C source files, .cpp, .cc or .cxx as C++ source files, .s and .asm as assembly code files.

The compiler driver recognizes the extension .o as object files, .a as library files, .ld as linker script files and .xml as special-purpose XML files.

We strongly recommend that you adopt these extensions for your source files and object files because you'll find that using the tools is much easier if you do.

C language files

When the compiler driver finds a file with a .c extension, it runs the C compiler to convert it to object code.

C++ language files

When the compiler driver finds a file with a .cpp extension, it runs the C++ compiler to convert it to object code.

Assembly language files

When the compiler driver finds a file with a .s or .asm extension, it runs the C preprocessor and then the assembler to convert it to object code.

Object code files

When the compiler driver finds a file with a .o or .a extension, it passes it to the linker to include it in the final application.