Hey all, I'm new here. Have been having a lot of fun with my trusty arduino 328, but i've run into a problem. I can import libraries as expected from regular source files, but not from .h's. If i try to import any library from a .h, it fails to find the relevant header. Smallest example that breaks:
//FAILS HERE with error: EEPROM.h: No such file or directory
#include <EEPROM.h> //can be any library, just an example.
class Cls1
{
private:
public:
Cls1();
};
Cls1.pde:
#include "Cls1.h"
Cls1::Cls1() {
}
Any ideas? I admit I'm not very good at C++, I may be overlooking something stupid.
Yeah, that's what I'm doing at the moment, it's a workaround. I just don't like the order of my #includes to matter.
That said, I'll just go with this way for now. I'll update if I find out something. Thanks!
Hi,
as you might know an arduino-sketch (pde-file) has to be preprocessed by the IDE to turn it into plain C-code that is handed over to the compiler.
This involves searching for all library-include statements in the main pde-file, and adding a compiler-directive to have them included in the resulting upload-code.
But the arduino-preprocessor does not do this for your extra *.h or .*cpp in your sketch. So what you are trying is not possible (with the current arduino-IDE version).