C++ STL in STM32Cube Project

Hi all,

I am attempting to use the C++ STL in a STM32Cube project to implement some queues and vectors, but when I try to include any STL headers (i.e. <vector.h>) I get an include error.

Any help would be appreciated!


Minimal code example and platformio.ini please. Are you trying to include it from a C file? STM32Cube is inherently a C framework.

Also, an embedded system might not support the entirty of the C++ STL (and you also shouldn’t use all of it, as some data structures alloc stuff on the heap, and heap fragmentation is a killer on embedded systems)

1 Like

in order to include vector you simply write

#include <vector>

int main()
  std::vector<int> myVec;

if that’s not the problem, please post the error message(s).

Oh and just an addendum, to include the C++ standard header for vectors you do #include <vector>, not #include <vector.h>. That may already explain your error.

I was including <vector.h> instead of <vector> - my bad, total brain fart. Thanks everyone!