Set the Include Directory Path for the MPLAB® XC32 Compiler

Last modified by Microchip on 2023/11/09 09:12

The Include Directory paths are used by the C compiler to find files referenced through #include directives. This is the preferred method of referencing include files that are not at the root of your project directory, as opposed to using relative paths in code: #include "subdirectory/filename.h").

Open the project properties window

Either right-click on the top node of the project in the Project window and select Properties from the pop-up window, or from the File menu, select Project Properties (ProjectName).

Project Properties
Click image to enlarge.

Back to Top


Select the compiler options

Select xc32-gcc from the Categories list on the left side of the Project Properties window. (GCC stands for GNU C Compiler)

XC32 GCC Compiler Selection
Click image to enlarge.

Back to Top


Preprocessing and messages settings

From the Option categories drop down menu select Preprocessing and messages

Preprocessor Settings
Click image to enlarge.

Back to Top


Add include directory path(s)

Click on the box next to the Include directories item to open the C include directories dialog box.

Include Directory Path
Click image to enlarge.

Back to Top


Create a new path

Click on the Browse button to select the desired directory.

Browse to the Directory
Click image to enlarge.

Back to Top