有没有一种方法可以在SmingIDE(ESP8266)中使用std::map

Is there a way to use std::map in Sming IDE (ESP8266)?

本文关键字:ESP8266 std SmingIDE map 一种 方法 有没有      更新时间:2023-10-16

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

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

据此http://www.esp8266.com/viewtopic.php?p=40593这个用于Arduino IDE(extenssa-lx106-elf-gcc)的ESP8266和std::映射链接错误应该将-lsdc++(可能还有-lsupc++)添加到要链接的库列表中。

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

LDFLAGS = -nostdlib ...

如果我把它改为-lsdc++-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/建议如下:

请尝试使用-nostlib链接选项。

太棒了!

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

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

提前感谢您的帮助。

最终构建它。最后一切都很简单。

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

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

并保持LDFLAGS不变(使用-nostlib)

LDFLAGS = -nostdlib ...