You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the IDE 1.0.6 the following code will compile and run properly
#include "Arduino.h"
String someText = "This is my example";
void setup() {
Serial.begin(115200);
Serial.println("Started");
}
void loop() {
String match = "NO";
// put your main code here, to run repeatedly:
if (someText.indexOf(match) == std::string::npos) {
Serial.println("No match");
} else {
Serial.println("Match");
}
delay(1000);
}
However, with 2.0.0-alpha1 compilation fails with:
/home/owen/Arduino/std.string.npos.reproduction/std.string.npos.reproduction.ino: In function 'void loop()':
std.string.npos.reproduction:14:41: error: 'std::string' has not been declared
if (someText.indexOf(match) == std::string::npos) {
^~~~~~
exit status 1
'std::string' has not been declared
So; starting from 2.0.0 the esp32 toolchain no longer supports the std::string class. This is actually in line with other boards; for instance the esp8266 and offiicial Arduino boards fail to compile this code giving the same error.
However, while this brings the ESP32 code into line with other Arduino toolchains, it will break some legacy projects that have taken advantage of std::string being present.
I'm submitting this issue not because I think this needs 'fixing' (I'll modify my code) but because I forsee quite a few older esp32 projects that will be broken by this, and having a placeholder for the issues will be useful. I could not see any existing discussion of this here or elsewhere.
The text was updated successfully, but these errors were encountered:
easytarget
changed the title
std::stringno longer available for 2.x (regression from 1.x)
std::string no longer available for 2.x (regression from 1.x)
Jul 1, 2021
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
Uh oh!
There was an error while loading. Please reload this page.
In the IDE 1.0.6 the following code will compile and run properly
However, with 2.0.0-alpha1 compilation fails with:
So; starting from 2.0.0 the esp32 toolchain no longer supports the std::string class. This is actually in line with other boards; for instance the esp8266 and offiicial Arduino boards fail to compile this code giving the same error.
However, while this brings the ESP32 code into line with other Arduino toolchains, it will break some legacy projects that have taken advantage of std::string being present.
I'm submitting this issue not because I think this needs 'fixing' (I'll modify my code) but because I forsee quite a few older esp32 projects that will be broken by this, and having a placeholder for the issues will be useful. I could not see any existing discussion of this here or elsewhere.
The text was updated successfully, but these errors were encountered: