I’ve been trying to get C++17 working, and for the most part it seemed to be working, but there is no
std::optional in there.
My platformio.ini looks like this:
[env] build_unflags = -std=gnu++11 build_flags = -std=c++17 [env:esp32dev] platform = espressif32 board = esp32dev framework = arduino monitor_speed = 115200
If I have
#include <optional> in my code, the error I get is:
In file included from src/main.cpp:12:0: fatal error: optional: No such file or directory
How can I get a fully working C++17 toolchain for ESP32?
After some time looking for answers, I’m just left even more confused about the different toolchains. What is the difference, for example, between
toolchain-xtensa-esp32 and which one should I use? When I include
toolchain-xtensa-esp32 it still uses the other one to build my application…
Looking into the contents of
toolchain-xtensa32 it does have the
optional header, so not sure why the toolchain can’t find it.