EEPROM.h doesn't include String library on its own now that it has String support

bazmonkey

Member
Code:
/Applications/Teensyduino.app/Contents/Java/hardware/teensy/avr/libraries/EEPROM/EEPROM.h:171:14: error: 'String' does not name a type
inline const String &EEPROMClass::put(int idx, const String &s)

The String support seems to not include the String library in it.

I notice this in .cpp files/headers (not the main .ino) where I haven't included <Arduino.h> but am using <EEPROM.h>

Including <Arduino.h> where it isn't already fixes the problem, but this wasn't necessary in 1.56 and is in 1.57.

Is this a bug? I'm new to C++ so I may be misunderstanding how this should work.
 
When using the IDE and INO files Arduino.h is included by default - when using .c or .cpp files they are compiled as presented.
 
I guess I'm asking if EEPROM.h should implicitly require String be included by me, or if it should include Arduino.h itself now that it depends on it.

In my mind including EEPROM.h should include everything EEPROM relies on. But I could be wrong I guess.
 
Sadly, in the several weeks of beta testing that lead up to each release, the number of beta testers we get using PlatformIO is usually zero. :(
 
If it feels too dirty to include the whole <Arduino.h> kitchen sink, you can just include <WString.h> before including <EEProm.h> pending a real fix.
 
I don't understand why PlatformIO wouldn't just do the Arduino.h include as Arduino does.

Yeah, don't do it when compiling a .cpp file. But all .ino files are written with the expectation that Arduino includes Arduino.h and adds function prototypes. By not replicating the Arduino pre-processing steps, it's an ongoing compatibility problem to compile .ino files.
 
If it feels too dirty to include the whole <Arduino.h> kitchen sink, you can just include <WString.h> before including <EEProm.h> pending a real fix.

Nah, it's fine. Just unexpected behavior. I'm still at the stage where if something doesn't work, I really don't know if it's just me or not :)
 
Back
Top