5 Command-line Driver

The MPLAB XC32 C/C++ Compiler command-line driver, (xc32-gcc or xc32-g++), can be invoked to perform all aspects of compilation, including C/C++ code generation, assembly and link steps. Its use is the recommended way to invoke the compiler, as it hides the complexity of all the internal applications and provides a consistent interface for all compilation steps. Even if an IDE is used to assist with compilation, the IDE will ultimately call xc32-gcc for C projects or xc32-g++ for C++ projects. MPLAB X IDE uses various heuristics to determine the project language. In some cases, it will add the -x flag to select the correct language, C or C++, and use any of the two drivers.

This chapter describes the steps that the driver takes during compilation, the files that the driver can accept and produce, as well as the command-line options that control the compiler’s operation.