Hi
As Paulino said, SPI requires my external C libraries to work.
And you must have the right version of ldmicro (5.3.1.0) because
some modifications have been made by the main developpers in earliest versions which make SPI and I2C inoperant.
Read "ComoHacer-PIC16.txt" file, available with ldmicro
Download HTC 9.82 compiler from my github:
https://github.com/joegil95/LdMicro32
...