Compile errors on EEPROM.h - 'String' does not name a type (T3.2)

I have a project that has been working just fine and today a github continuous integration started throwing an error with regards to PlatformIO compiling.

Seems there's been some update to the teensy libraries? My previous install was working fine, but after updating teensy libraries I see the compile error on my setup as well (PIO in vscode). Errors below

This seems related to changes to EEPROM.h on April 8, 2022 (?)

I see the same issue when compiling with a brand new install of Teensyduino 1.57

Stackoverflow shows some solutions for this type of error by including
Code:
#include <string> 
using namespace std;

But - shouldn't that be part of the EEPROM library?

What am I doing wrong?

Code:
In file included from OMX-27-firmware/storage.cpp:1:0:
/Users/nevetsokyeron/.platformio/packages/framework-arduinoteensy/libraries/EEPROM/EEPROM.h:171:14: error: 'String' does not name a type
 inline const String &EEPROMClass::put(int idx, const String &s)
              ^
/Users/nevetsokyeron/.platformio/packages/framework-arduinoteensy/libraries/EEPROM/EEPROM.h:191:8: error: 'String' does not name a type
 inline String &EEPROMClass::get(int idx, String &s){
        ^
 
replying to myself here...

adding this before my EEPROM.h include seems to solve the compile error (In Teensyduino anyway), but I'd like to know why this is now needed when it was not before

#include <WString.h>
 
Some libraries depend on include Arduino.h, which Arduino IDE automatically adds, but PlatformIO does not.

but I'd like to know why this is now needed when it was not before

EEPROM get() and put() were improved to work properly with String variables, thanks to a contribution from Luni64. With Teensyduino 1.56 and earlier, attempting to use any String variable did not work properly. Even if you don't personally use String or see the value in supporting it, people who do use String ran into this limitation. Code was added in EEPROM.h to make that case work automatically. But it seems nobody using PlatformIO ever tests the beta versions, so even though we had 4 beta versions published before releasing 1.57, it seems all testing was done only with Arduino IDE 1.8.x and 2.0-rc.x.
 
Thanks for the info on the changes to EEPROM.h

Some libraries depend on include Arduino.h, which Arduino IDE automatically adds, but PlatformIO does not.

To be clear - arduino.h is/was included in this project already (unless it needs to be re-included for some reason).

including WString.h fixed the compile errors. Is that the correct solution?
 
Back
Top