I reduced my code to this simple example:
#include <list>
class C
{
public:
struct s
{
String a;
String b;
};
std::list<s> l;
void add(String a, String b) { s mys = {a, b}; l.push_back(mys); }
};
void setup() {
C myC;
myC.add("", "");
}
void loop() {}
When compiling it for the ESP8266 I get the following error:
[...]sketch\sketch_apr25a.ino.cpp.o:(.text.setup+0x4): undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
[...]sketch\sketch_apr25a.ino.cpp.o: In function `setup':
[...]sketch_apr25a.ino:19: undefined reference to `std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)'
collect2.exe: error: ld returned 1 exit status
I tried compiling it in regular C++ (without the Arduino IDE) and it worked fine so I really don't understand what's wrong with my code. Does anybody know what's going on here? (Yes, I tried understanding the error message but couldn't figure it out myself.)
Thanks for reading!