gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 13:13:33 25 4
gpt4 key购买 nike

我正在尝试在使用 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还有这个ESP8266 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/推荐如下:

Try using the -nostdlib link option.

太棒了!

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

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

在此先感谢您的帮助。

最佳答案

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

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

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

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

LDFLAGS = -nostdlib ...

关于c++ - 有没有办法在 Sming IDE (ESP8266) 中使用 std::map?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38557151/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com