Hi,
I have a file that I have used for many years. I wanted to add some new functions, some define statements and variable declarations. I added this new file as a source in my MPLAB project. The compiler errors on '#device statement required in the new file'. When I add a device statement the compiler then states that I can't change the device this far into the code. The device statement is the same
#device = PIC18F4685.
Any suggestions?
Thanks
Don't use a separate line with a #device = PIC18F4685 statement.
That statement already exists in the .H file for your PIC. Just include
the 18F4685.H file with an #include statement at the top of your main
source file.
Add all additional modules (C source files) to your main program with
#include statements. Don't add them to the "Source Files" list in MPLAB.
The "Source Files" list should only have your main source file.
For convenience, you can add additional source files to the "Other Files"
list in MPLAB. This is just so you can easily click on them and view them.
hawker Guest
Posted: Fri Nov 20, 2009 7:44 pm
Thanks, that fixed it. Does this imply that any .c file in the "other" file category is compiled with the main source? I have no reference to my second file in the main source file.
Thanks again
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Fri Nov 20, 2009 8:00 pm
Remove it from the "Other Files" list and see what happens. Experiment.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum