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.