This is driving me nuts. So I've got this program that is working perfectly, but it spans about 10 tabs in a sketch and is getting rather unwieldy, so I start a new sketch and I'm cutting and pasting from old to new, and while I'm at it I'm rearranging things into .cpp and .h files so I can make it more modular.
No matter which .cpp tab comes first they always get this error:
e_loop.cpp:3:20: error: EEPROM.h: No such file or directory
e_loop.cpp:4:20: error: Bounce.h: No such file or directory
(the file name changes depending on which .cpp tab comes "first" of course). The include for EERPOM.h and Bounce.h were generated by Sketch -> Import Library in all cases. What am I missing here?
Are those two libraries EEPROM.h and Bounce.h coming with Arduino IDE or with your 10-tabbed program. If it's the latter, use "EEPROM.h" instead of <EEPROM.h>
They're standard Arduino libraries. The very same includes worked just fine in the working version of my program. And besides, I've tried both versions of the include - no joy.
Did you #include <Bounce.h> and <EEPROM.h> (and other files needed by your other tabbed files) in your main sketch?
When Arduino pulls things together to compile, it goes through the main sketch looking for library stuff. I know, I know, it seems a little peculiar, but... (See Footnote.)
Just import the libraries in the main sketch the same way you imported them in the other tabs. For core libraries and Arduino-supplied libraries and, in fact for any properly crafted headers, the order is not important. The only important thing is that "WProgram.h" must be included before other Arduino stuff in your tabbed files.
Regards,
Dave
Footnote:
It's the Arduino Way. Resistance is futile. You will be assimilated!