Electrical – MPLAB Program won`t recognize xc.h header

microcontrollermplabx

I am trying to learn how to program my PIC microcontoller (specifically a PIC24FJ128gc010 MCU), but having some trouble with what should be a very simple program.
I can't declare any pins as outputs or inputs, or do anything really because the
#include <xc.h>
has a yellow underline. I control clicked it to investigate more and MPLAB says that the header file for my specific microcontorller cannot be found, but I was able to find it in my xc16 installation directory (C:\Program Files (x86)\Microchip\xc16\v1.50\support\PIC24F).

Best Answer

Try to add all the items from the /include folder that is locate where you installed the xc8 or xc16.

To do this, right-click the project and go to properties.

Go to XC8 global option (or XC16) and click on XC8 compiler (or XC16).

Click the three dots righ next to "Include Directories".

Click browse and find the following directory \Program Files\Microchip\xc8\vx.xx\pic\include, there you will find some other folders, you will add all of them, one by one.

Hit apply.