Hi,
I have problems with compiling sketches which includes EEPROM.h, DallasTemperature.h, OneWire.h and others, but not as Wire.h, NewLiquidCrystal.h or IRremote.h. Also, examples from that problematic libraries are compiling without any problems. Error at compilng says: fatal error: EEPROM.h: No such file or directory, but that's imposible.
My code is pretty long, but it worked fine before I started to include these libs. Also, sorry for comments in polish.
Code:
SchoolProject.ino - Pastebin.com (SchoolProject.ino)
Callbacks.h - Pastebin.com (Callbacks.h)
Enums.h - Pastebin.com (Enums.h)
Pages.h - Pastebin.com (Pages.h)
SchoolProject.h - Pastebin.com (SchoolProject.h)
Shared.h - Pastebin.com (Shared.h)
ThreadingTimer.h - Pastebin.com (ThreadingTimer.h)
My code is pretty long
So, use Reply, and the Additional Options link to attach your code here, rather than dumping it in the rubbish bin.
Sorry for that, here's code.
Callbacks.h (1.6 KB)
Enums.h (337 Bytes)
Pages.h (6.98 KB)
SchoolProject.h (19 Bytes)
SchoolProject.ino (1.27 KB)
Shared.h (1.74 KB)
ThreadingTimer.h (429 Bytes)
There are a lot of problems with your code.
The EEPROM library is not part of the sketch folder, so
#include "EEPROM.h"
is wrong. It should be
#include <EEPROM.h>
In a header file, you define variables. You do NOT initialize them.
long previousMillis = 0;
Loose the assignment.
Once I added
#include <EEPROM.h>
the only errors left related to the LiquidCrystal_I2C library that I don't have.
I gave you old version of that file (sorry), in current version I have
#include <EEPROM.h>
and that's not it. If you're not beliving me, that's a screenshot of that nonsense:
My code looks like this because usually I'm programming in Java, where you don't have anything like header files. I'm trying to change my style of coding in C++, but that will take some time
Did you add #include <EEPROM.h> to the .ino file? You MUST!
Thanks, that worked, but why? Can you explain it to me? I included header that includes that library.
Can you explain it to me?
Sure. The IDE copies the files in the sketch directory to a build directory. It copies the sketch file, with additions, to a cpp file in the build directory. It copies the header files, and associated source files, included in the sketch BUT NOT OTHER FILES, to the build directory. When the compiler runs, if it isn't in the build directory, it doesn't exist.
So, when you do not include EEPROM.h in the sketch, it is not copied to the build directory. Therefore, it does not exist, and can't be included by the sketch or any other cpp file.
That makes sense, one more time, thanks!