The error the compiler is complaining about it’s this: newmain.c:11: error: (141) can’t open include file “spi.h”: No such file or directory. You have this line of code in your project: #include “spi.h” but you don’t have this “spi.h” file in your project. You can’t include a file unless you have created/added that file.
There is no need to have this #include <p18cxxx.h> in your main code as in your “newxc8_header.h” you have included already: #include <xc.h>. With XC8 compiler #include <xc.h> is sufficient to include the PIC