1
\$\begingroup\$

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).

\$\endgroup\$
10
  • 2
    \$\begingroup\$ Does your project include paths point to your folder that you found? \$\endgroup\$
    – Ron Beyer
    Commented Apr 17, 2020 at 16:10
  • \$\begingroup\$ I`m not sure, how would I check that? \$\endgroup\$ Commented Apr 17, 2020 at 16:30
  • 1
    \$\begingroup\$ Right click the project, go to properties, find the source paths and make sure it's included. \$\endgroup\$
    – Ron Beyer
    Commented Apr 17, 2020 at 16:34
  • \$\begingroup\$ Sorry, could be more specific, I am in the Project Properties window, where do I go from there? \$\endgroup\$ Commented Apr 17, 2020 at 16:40
  • 1
    \$\begingroup\$ This is turning into a "How do I use MPLAB to write code for a PIC" question and, as such, is far too broad... \$\endgroup\$
    – brhans
    Commented Apr 17, 2020 at 20:32

1 Answer 1

3
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ Only Legacy and proc folders are needed, c90 and c99 throw some other errors. \$\endgroup\$
    – Chad
    Commented Feb 22, 2021 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.