-->
Page 1 of 1

Is there a way to use std::map (and other containers)?

PostPosted: Sun Jul 24, 2016 11:40 am
by lukegluke
Hi all.

I'm trying to use std::map<Key, Value> in Sming 2.1.0 application.
I've got following building error:
Code: Select allundefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'

According to this viewtopic.php?p=40593 one should add -lstdc++ (and potentially -lsupc++) to the list of libraries to link with.

But in Makefile-project.mk in Sming there is -nostdlib flag!
Code: Select allLDFLAGS   = -nostdlib ...

If I change it to -lstdc++ -lsupc++ I've got those errors instead:
Code: Select allc:/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

And to solve this here https://www.reddit.com/r/esp8266/commen ... rd_errors/ recommended following:
Code: Select allTry using the -nostdlib link option.

Excellent!
After all, I haven't find final answer: "If there any way to use std::map in Sming?"

Thank you in advance for help.

Re: Is there a way to use std::map (and other containers)?

PostPosted: Mon Jul 25, 2016 2:12 am
by lukegluke
Build it after all. In the end it was simple.

Add stdc++ supc++ to LIBS not to LDFLAGS That is:
Code: Select allLIBS = stdc++ supc++ microc ...

And remain LDFLAGS the same (with -nostdlib)
Code: Select allLDFLAGS = -nostdlib ...