I have a code in Visual studio that I want to implement in Arduino. But there is a problem. Many libraries usable in Visual Studio aren't usable in the Arduino IDE. How can I use them in my Arduino code? To be precise, the libraries I want to use are

#include <iostream>
#include <iomanip>
#include <queue>
#include <string>
#include <math.h>
#include <ctime>

I know I have <iostream> available in Arduino. <math.h> is also available I think along with the <string> library. The main problem is to how to use #include<queue> and its functions such as priority_queue() and other functions of iosteam like .pop()? Any help would be highly appreciated.

  • Weird, I can remember using the same ATMega328P with another compiler, where it did work. Though you can check if an external library fits your needs: playground.arduino.cc/Code/QueueList But I would understand if you prefer a solution rather than a work-around?
    – aaa
    Commented Jul 9, 2015 at 11:29
  • The Arduino doesn't have an operating system, so therefore doesn't have a C standard library. Commented Jul 9, 2015 at 17:07
  • 1
    @mypal125: The Arduino does have a standard C library (avr-libc for the AVR based boards). What it lacks is the C++ STL, but see Nick Gammon's answer on how to add it. Commented Jul 10, 2015 at 7:57
  • @EdgarBonet: TIL! Commented Jul 10, 2015 at 13:36

1 Answer 1


Some of the libraries you mention (iomanip, iostream, queue, string) are part of the STL - Standard Template Library. Whilst it does not ship with the IDE download, you can install it yourself. See The Standard Template Library (STL) for AVR with C++ streams - a port to the Arduino by Andy Brown.

I have some implementation notes here.

Be aware that a lot of Arduinos don't have much RAM, so you need to use libraries like this with caution.

Library download: AVR standard template library, version 1.1.1 - 197.29 kB


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.