我试图在用Sming 2.1.0开发的ESP8266固件中使用std::map (在Windows7 SP1上)。我有以下错误:
undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'根据这个http://www.esp8266.com/viewtopic.php?p=40593和这个ESP8266 for Arduino IDE (xtensa-lx106-elf-gcc) and std::map linking error,应该将-lstdc++ (以及潜在的-lsupc++)添加到要链接的库列表中。
但是在Makefil-project.mk中,在Sming有-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为了解决这个问题,errors/建议如下:
尝试使用-nostdlib链接选项。
非常出色!
我试过使用来自arduino- use 8266 https://github.com/rogerclarkmelbourne/arduino-esp8266/tree/master/tools/xtensa-lx106-elf的xtensa-lx106-elf (它包括crt1-sim.o、_vectors.o和其他库),但没有帮助。
我还没有找到最终的答案:“如果有什么方法在Sming中使用std::map等等?”
提前谢谢你的帮助。
发布于 2016-07-24 22:50:06
毕竟要建造它。结果很简单。
我应该将stdc++ supc++添加到LIBS中,而不是LDFLAGS,即:
LIBS = stdc++ supc++ microc ...并保持LDFLAGS不变(使用-nostdlib)
LDFLAGS = -nostdlib ...https://stackoverflow.com/questions/38557151
复制相似问题