Problems with std::map in ESP8266 Arduino library
Posted: Sat Oct 31, 2015 2:03 am
Hello guys.
I'm using Arduino 1.6.5 with ESP8266 library. My goal is create map of String to store options in ESP's FS
I declare map like this:
Now each way of inserting new key-value pair
or
or
all leads to same result:
Arduino: 1.6.5 (Windows 8.1), Board: "Generic ESP8266 Module, Serial, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS)"
pfile.cpp.o: In function `std::map<String, String, std::less<String>, std::allocator<std::pair<String const, String> > >::operator[](String&&)':
\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\xtensa-lx106-elf\include\c++\4.8.2\bits/shared_ptr_base.h:547: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
pfile.cpp.o: In function `std::_Rb_tree<String, std::pair<String const, String>, std::_Select1st<std::pair<String const, String> >, std::less<String>, std::allocator<std::pair<String const, String> > >::_M_get_insert_unique_pos(String const&)':
\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\xtensa-lx106-elf\include\c++\4.8.2\bits/stl_tree.h:1330: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
pfile.cpp.o: In function `Print::operator=(Print&&)':
\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\xtensa-lx106-elf\include\c++\4.8.2\bits/stl_tree.h:1338: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
pfile.cpp.o: In function `PFile::load()':
\AppData\Local\Temp\build7864248188764169690.tmp/pfile.cpp:30: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
\AppData\Local\Temp\build7864248188764169690.tmp/pfile.cpp:37: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
pfile.cpp.o: In function `std::_Rb_tree<String, std::pair<String const, String>, std::_Select1st<std::pair<String const, String> >, std::less<String>, std::allocator<std::pair<String const, String> > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<String const, String> >, String const&)':
\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\xtensa-lx106-elf\include\c++\4.8.2\bits/stl_tree.h:1423: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
pfile.cpp.o: In function `pair<String&&, 0u>':
\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\xtensa-lx106-elf\include\c++\4.8.2/tuple:1088: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
collect2.exe: error: ld returned 1 exit status
Error compiling.
Does anybody has an idea how to fix it?
I'm using Arduino 1.6.5 with ESP8266 library. My goal is create map of String to store options in ESP's FS
I declare map like this:
Code: Select all
typedef std::map<String, String> Items;
Items items;
Now each way of inserting new key-value pair
Code: Select all
items["key"]="value";
or
Code: Select all
items.at("key")="value";
or
Code: Select all
items.emplace("key","value");
all leads to same result:
Arduino: 1.6.5 (Windows 8.1), Board: "Generic ESP8266 Module, Serial, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS)"
pfile.cpp.o: In function `std::map<String, String, std::less<String>, std::allocator<std::pair<String const, String> > >::operator[](String&&)':
\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\xtensa-lx106-elf\include\c++\4.8.2\bits/shared_ptr_base.h:547: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
pfile.cpp.o: In function `std::_Rb_tree<String, std::pair<String const, String>, std::_Select1st<std::pair<String const, String> >, std::less<String>, std::allocator<std::pair<String const, String> > >::_M_get_insert_unique_pos(String const&)':
\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\xtensa-lx106-elf\include\c++\4.8.2\bits/stl_tree.h:1330: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
pfile.cpp.o: In function `Print::operator=(Print&&)':
\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\xtensa-lx106-elf\include\c++\4.8.2\bits/stl_tree.h:1338: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
pfile.cpp.o: In function `PFile::load()':
\AppData\Local\Temp\build7864248188764169690.tmp/pfile.cpp:30: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
\AppData\Local\Temp\build7864248188764169690.tmp/pfile.cpp:37: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
pfile.cpp.o: In function `std::_Rb_tree<String, std::pair<String const, String>, std::_Select1st<std::pair<String const, String> >, std::less<String>, std::allocator<std::pair<String const, String> > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator<std::pair<String const, String> >, String const&)':
\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\xtensa-lx106-elf\include\c++\4.8.2\bits/stl_tree.h:1423: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
pfile.cpp.o: In function `pair<String&&, 0u>':
\appdata\roaming\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9\xtensa-lx106-elf\include\c++\4.8.2/tuple:1088: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
collect2.exe: error: ld returned 1 exit status
Error compiling.
Does anybody has an idea how to fix it?