Fatal error: vector: No such file or directory, problem with accessing std libraries

For some reason I cannot use any libraries from std namespace, I try to include vector and it does not compile.

main.cpp:

#include <Arduino.h>

#include <vector>

void setup() {

// put your setup code here, to run once:

}

void loop() {

// put your main code here, to run repeatedly:

}

platformio.ini:

;PlatformIO Project Configuration File

;

; Build options: build flags, source filter

; Upload options: custom upload port, speed and extra flags

; Library options: dependencies, extra library storages

; Advanced options: extra scripting

;

; Please visit documentation for the other options and examples

; https://docs.platformio.org/page/projectconf.html

[env:megaatmega2560]

platform = atmelavr

board = megaatmega2560

framework = arduino

after compiling:

> Executing task in folder testplatformio: platformio run <

Processing megaatmega2560 (platform: atmelavr; board: megaatmega2560; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/megaatmega2560.html
PLATFORM: Atmel AVR > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)
HARDWARE: ATMEGA2560 16MHz 8KB RAM (248KB Flash)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 5 compatible libraries
Scanning dependencies...
No dependencies
Compiling .pioenvs/megaatmega2560/src/main.cpp.o
src/main.cpp:2:18: fatal error: vector: No such file or directory
compilation terminated.
Compiling .pioenvs/megaatmega2560/FrameworkArduino/WMath.cpp.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/WString.cpp.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/abi.cpp.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/hooks.c.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/main.cpp.o
Compiling .pioenvs/megaatmega2560/FrameworkArduino/new.cpp.o
*** [.pioenvs/megaatmega2560/src/main.cpp.o] Error 1
Compiling .pioenvs/megaatmega2560/FrameworkArduino/wiring.c.o
============================================================================= [ERROR] Took 0.36 seconds =============================================================================
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

Arduino by itself does not support the C++ STL.

1 Like