well example 1 was the only thing which never ever produced ne errors when i was working in mplab so u must have done some thing wrong during compilation
so i wud recommend to first add header file according to ur controller and then go through the pdf files provided on the site for getting started in mplab,
and there is nothing wrong with header files, every thing is correctly defined, ur follow up is more vulnerable to mistakes