Fatal error: functional: No such file or directory

Sorry, I am a newbie. I am trying to port a Arduino Nano program from Arduino ide to platformio.

One of my .h files has

#include <functional>

Compiling gives an error at this line and stops compiling with error

fatal error: functional: No such file or directory

I know I will get it with and some others.

Is it possible to fix this?

The <functional> header and its functionality do not exist on the AVR GCC/G++ compiler. I highly recommend to not use the C++ standard library on these extremely constrained microcontroller devices anyway; Alternative and supplements to AVR-GCC’s lacking stdlib implementation still exist though: see Arduino c++11 or c++14 support in platform IO - #3 by maxgerhardt, where this exact topic was already discussed.

Hold up. #include <functional> compiles in the Arduino IDE for AVR devices? That contradicts everything I’ve seen before…

Can you show a screenshot of your exact Arduino IDE configuration (board etc), the Arduino IDE version, and the board package version (for e.g. the AVR devices)?

Max,

Thank you. A newbie mistake made coming to grips with PlatformIO. I have sorted the problem, it wasnt related to what I thought was the problem. Many thanks for your help. I had found the references you mentioned. At that stage it didnt help me.

Craig

You may be interested in my open source template library on Github.
Very embedded friendly.
Embedded Template Library