Newer versions of XC8 want you to use the “MPLAB Code Configurator” when using any peripheral.

Using the old peripheral libraries

If you don’t want to use the MPLAB Code Configurator you can still get the old peripheral libraries by downloading and installing “PIC18F Legacy Peripheral Libraries v#.#” from the microchip compilers page.

Install it into the specific xc8 version folder you have.

For your project to use them you’ll need to add its path:

Project properties > XC8 Global Options > XC8 Compiler > Include directories: Enter the path, e.g. “C:\Program Files (x86)\Microchip\xc8\v2.05\include\plib”

For XC8 V2 there is no longer a project properties option for “Link in Peripheral Library” it seems, so you’ll also have to the include the header file for the library you are using in your code files, e.g.

#include <i2c.h>
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.