3.2.4 How Can I Select Which Compiler I Want to Build With?

The compilation and installation process has been designed to allow you to have more than one compiler installed at the same time. You can create a project in VS Code or the MPLAB X IDE and then build this project with different compiler versions by simply changing a setting in the project properties. If you are building on the command line or via a build script, simply specify the path to the specific compiler version you wish to execute.

To select which compiler version will be used to build a project under MPLAB X IDE, go to the Project Properties dialog. Select the Configuration category (for example, Conf: [default], where default represents the name of the project configuration). A list of MPLAB XC8 compilers is shown in the Compiler Toolchain, on the far right. Select the compiler that you require.

Once selected, the controls for that compiler are shown by selecting the XC8 Global options, MPLAB XC8 Compiler, MPLAB XC8 Linker, and Analysis categories. These reveal a pane of options on the right. Note that each category has several panes which can be selected from a pull-down menu that is near the top of the pane.

In VS Code, the compiler version can be selected from the Project Properties. Ensure your desired configuration is selected, then open the Toolchain category. A drop-down menu of available compilers lets you make your selection. Once a compiler has been selected, the options for that compiler can be adjusted in the Global, C Compiler, Linker, and Code Coverage categories.