Thanks for your replies.I found the problem. the 'include' and 'library' file paths were not set in the 'Build options'. I set the locations and it works fine now.I guess the problem was with the drive i installed it(installed both MPLab and C18 in E:\),but i reckon it should have been set by default.
But one thing that i find strange is that i have to set the paths for both of them in each project.Also i have one question, whats wrong with this statement:
Thanks.
I always use the project wizrd for creating MPLAB projects(got it from your video tutorial).I guess then its some installation problem will check it out and see if i fix it.