fatal error: ‘p18f23k22.h’ file not found

You no longer include the device specific header file like this:

#include <p18f23k22.h>

Instead you include this file:

#include <xc.h>

This header file is typically included into each C source file you write. It is a generic header file that will include other device- and architecture-specific header files when you build your project.

#asm – error: invalid preprocessing directive

Project properties > XC8 Global Options: change “C Standard” from “C 99” to “C 90”.

Also do for XC8 Global Options > XC8 Linker > Link in C library

It will now accept “#asm”. This is the official reason: “In-line assembly The #asm … #endasm form of inline assembly is no longer accepted when building for C99. The asm() form of inline assembly is now the only way to embed assembly instructions inline with C code.”

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.


Your email address will not be published.