"Unable to resolve identifier" is a linker error. Linker is a program that takes all the compiled pieces of code and "mashes" it into one single piece of code that includes all the needed functions etc. It needs to resolve all function calls so that they work properly and that all functions are placed correctly in memory so that they can be called correctly. The problem you are having is that the linker can not find the __delay_us() function anywhere. I have not used MPLAB XC, but there must be a setting somewhere (Linker Files.. maybe) that you can include the correct library to the project so that the linker can find it.
Sooo... I found that if I actually included #define __delay_ms(x) and/or #define __delay_us(x) depending on which one or both I am using it ceases giving an error... finickity? one wonders why this isnt an automatic thing as pic.h should automatically be used by the parser....
Sooo... I found that if I actually included #define __delay_ms(x) and/or #define __delay_us(x) depending on which one or both I am using it ceases giving an error... finickity? one wonders why this isnt an automatic thing as pic.h should automatically be used by the parser....
I'm not sure what you did to get rid of the error.. Did you define the __delay_ms(x) macro yourself by adding this line to your code:
#define __delay_ms(x)
If you did that, then you re-defined the macro to do nothing. It gets rid of the error, but you are only replacing the original delay call with "nothing".
In the LCD C file OR before you define it in your main file.. either way before you call a delay function.... BTW I don't think you can use a float in the delay arguments..
If I understand correctly, by defining this line I have got rid of the parse error but the program wont run.... so is this something I will have to put up with? Its unnerving to see red underline in your program and know that is still works... can anything be done to correct this?
True.. maybe. If the delay is a macro that builds some optimized asm-loop, then the float may work. Like, if the macro translates to " 0.5*100 ", then pre-processor will compute the correct value "50". I have no idea how the delay is defined in the library OP is using.
should that be an #include or a #define? it errors with #include and says it cant find the include if I change it. I have changed it back to #define. I tried to move it right to the top and then the bottom of the includes and it still shows a parse error. Is this something I am having to live with?
If I understand correctly, by defining this line I have got rid of the parse error but the program wont run.... so is this something I will have to put up with? Its unnerving to see red underline in your program and know that is still works... can anything be done to correct this?
The program will run, but the delay will not work because you replaced the original __delay_ms(x) with empty definition. (If you did write the line "#define __delay_ms(x)")
You need to include the correct library when you are using functions that are part of the library that comes with the compiler or Integrated Development Environment (IDE) (MPLAB XC).
Yes I understand that the correct library needs to be included. However this was a finished supposedly fully working MPLAB XC example. I assumed it would have been created with all the correct required includes. I have removed the hacking I did however am I missing an include or is this a parsing issue thats wrong despite a buildable project.... it builds OK.
should that be an #include or a #define? it errors with #include and says it cant find the include if I change it. I have changed it back to #define. I tried to move it right to the top and then the bottom of the includes and it still shows a parse error. Is this something I am having to live with?
Ok!! I find no issues atall with your code... It works as expected.. The compiler is whinging about a header file AND the C file including "xc.h" just comment out the one in the LCD header file
Yes I understand that the correct library needs to be included. However this was a finished supposedly fully working MPLAB XC example. I assumed it would have been created with all the correct required includes. I have removed the hacking I did however am I missing an include or is this a parsing issue thats wrong despite a buildable project.... it builds OK.
I hear this problem all the time when people use C to program PICs. I have no idea what is going on with the tools.. the documentation is crappy, so you can't even try to find out what is wrong. Move on to using AVR. GCC is the best compiler out there.. solely because of the quality of the documentation.