std::map error: undefined reference to std::_Rb_tree_decrement

Status
Not open for further replies.

dbh97

New member
Hi. I am trying to use std::map, but am getting errors.
I am using a Teensy 3.1. I have tried both the Arduino software and Make. I am running ArchLinux.

MNWE:

Code:
#include "stdlib.h"
#include "map"

void setup() {
  // put your setup code here, to run once:
 std::map<int, int> foobar;
 foobar[1] = 5;
}

void loop() {
  // put your main code here, to run repeatedly:

}

Error:

Code:
/tmp/build684d5482831b8cc901740cd5055404f4.tmp/sketch/map_test.ino.cpp.o: In function `std::_Rb_tree_iterator<std::pair<int const, int> >::operator--()':
/usr/share/arduino/hardware/tools/arm/arm-none-eabi/include/c++/4.8.4/bits/stl_tree.h:204: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
/usr/share/arduino/hardware/tools/arm/arm-none-eabi/include/c++/4.8.4/bits/stl_tree.h:204: undefined reference to `std::_Rb_tree_decrement(std::_Rb_tree_node_base*)'
/tmp/build684d5482831b8cc901740cd5055404f4.tmp/sketch/map_test.ino.cpp.o: In function `std::_Rb_tree_iterator<std::pair<int const, int> >::operator++()':
/usr/share/arduino/hardware/tools/arm/arm-none-eabi/include/c++/4.8.4/bits/stl_tree.h:189: undefined reference to `std::_Rb_tree_increment(std::_Rb_tree_node_base*)'
/tmp/build684d5482831b8cc901740cd5055404f4.tmp/sketch/map_test.ino.cpp.o: In function `std::_Rb_tree<int, std::pair<int const, int>, std::_Select1st<std::pair<int const, int> >, std::less<int>, std::allocator<std::pair<int const, int> > >::_M_insert_node(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node<std::pair<int const, int> >*)':
/usr/share/arduino/hardware/tools/arm/arm-none-eabi/include/c++/4.8.4/bits/stl_tree.h:1575: undefined reference to `std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)'
collect2: error: ld returned 1 exit status

Is std::map not usable on the Teensy?
 
For anyone encountering a similar issue with Map for use in SAMD21 Pro RF using Arduino IDE with arm-none-eabi-gcc version 4.8.3-2014q1. Or Arduino take a look at this repository github.com/Potsdam-Sensors/CPPMap
 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top