ArduinoSTL yields numerous errors on build


i just installed the ArduinoSTL library 1.1.0 in order to utilize some of its functions. However, when i build my project i get numerous errors in the following files (Apart from the ArduinoSTL.h file, none of these are included in my project): algorithm, cmath, cstdlib, memory and new.

To be more specific it’s 74 errors, out of which a majority of them are reported as undeclared variables in the library. I could give more detailed info if needed.

My project is for a Due board (SAM).

I have no idea to proceed from here. Any help is appreciated!

Can you provide your platformio.ini and a simple main.cpp so we can reproduce the problem?

Thanks for your quick reply.

platformio.ini contains:

platform = atmelsam
board = dueUSB
framework = arduino
lib_deps = 
monitor_speed = 1200

(I’m using the native USB port, because the programming port needs repairing).

Here’s a minimal reproducible example of main.cpp that yields the errors:

#include <Arduino.h>
#include <ArduinoSTL.h>

void setup() {
  // put your setup code here, to run once:

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

Wow, that’s a hard one.

There is clearly a mixup of header files provides by ArduinoSTL and the compiler itself, e.g. cstdlib exists both in ArduinoSTL (.pio\libdeps\due\ArduinoSTL\src) and in the compiler directories (C:\Users\xxx\.platformio\packages\toolchain-gccarmnoneeabi@1.70201.0\arm-none-eabi\include\c++\7.2.1)

stdlib.h (from the compiler directory) then includes cstdlib and processes the one from ArduinoSTL instead of from the same compiler directory. This is probably wrong.

I’m not sure yet how to resolve it…

1 Like

I appreciate the feedback, since i couldn’t have figured this out on my own… I also tried the StandardCplusplus library with similar errors, fyi.

If a fix needs time, i’ll have to consider other options since i need some of the stl functions… Are there any alternatives to ArduinoSTL on top of your head?

What exactly is the ARM GCC compiler toolchain missing that you need?

Hey. I also got the same problem and tried to figure out, why it does not work.

I realized, that not every Arduino is compatible wih the ArduinoSTL. The library just supports the AtmelAVR Platform. If you have an Arduino with another platform, it propably won’t work.

The PlatformIO documentation gives you information about the platform of your Arduino, as well as the supported platforms of a library