'std::string' has not been declared after update

Today Arduino IDE gave me a popup notifying there are updates to board files.
I allowed the update, and now my sketch doesn't compile. The error I get is:

Compilation error: 'std::string' has not been declared

The trigger is the line static void setSsid(std::string value); inside of a class declaration.

Given that I did not touch anything other than doing the update, and this was compiling before, it seems like the update changed something in the includes I'm using.

If I try to #include <string>, I get past the above error, but now conversions between String
and std::string that used to work implicitly before, throw an error:

Compilation error: conversion from 'String' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string'} requested

Again, this didn't use to happen before. How can I figure out what changed to cause this? I'm developing on an ESP32 board.

void setSsid(String value);

OK so looks like what happened was that I upgraded Espressif Arduino core for ESP32 from version 2.x to 3.x.

The changes include switching some peripheral APIs from working with std::strings to Strings, which is responsible for the conversion errors, and it also likely removed some instance of #include <string> from those libraries, so my sketch was no longer receiving it "for free".

Reverting to last 2.x version returned me to a successfully compiling version.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.