有没有办法在Sming IDE(ESP8266)中使用std :: map?

时间:2016-07-24 21:46:51

标签: c++ libstdc++ esp8266 sming

我试图在使用Sming 2.1.0开发的ESP8266固件中使用std :: map(在Windows 7 SP1上)。 我有以下错误:

undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'

根据此http://www.esp8266.com/viewtopic.php?p=40593ESP8266 for Arduino IDE (xtensa-lx106-elf-gcc) and std::map linking error,应该将-lstdc ++(可能是-lsupc ++)添加到要链接的库列表中。

但是在Sming的Makefile-project.mk中有-nostdlib标志!

LDFLAGS = -nostdlib ...

如果我将其更改为-lstdc ++ -lsupc ++,我会收到这些错误:

c:/espressif/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/5.1.0/../../../../xtensa-lx106-elf/bin/ld.exe: cannot find crt1-sim.o: No such file or directory
c:/espressif/xtensa-lx106-elf/bin/../lib/gcc/xtensa-lx106-elf/5.1.0/../../../../xtensa-lx106-elf/bin/ld.exe: cannot find _vectors.o: No such file or directory

并在此处解决此问题https://www.reddit.com/r/esp8266/comments/3pmyx8/trying_to_link_but_getting_weird_errors/,建议如下:

  

尝试使用-nostdlib链接选项。

辉煌!

我尝试过使用arduino-esp8266的xtensa-lx106-elf https://github.com/rogerclarkmelbourne/arduino-esp8266/tree/master/tools/xtensa-lx106-elf(它包括crt1-sim.o,_vectors.o和其他libs),但它没有帮助。

我还没有找到最终答案:"如果有办法在Sming中使用std :: map等等?"

提前感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

毕竟构建它。最后很简单。

我应该将stdc ++ supc ++添加到LIBS而不是LDFLAGS 那就是:

LIBS = stdc++ supc++ microc ...

保持LDFLAGS相同(使用-nostdlib)

LDFLAGS = -nostdlib ...
相关问题