PaulStoffregen / cores

Teensy Core Libraries for Arduino
507 stars 372 forks source link

std::optional doesn't work #588

Open tech-alp opened 3 years ago

tech-alp commented 3 years ago

I'm using a Teensy 3.6 microcontroller. I want to use std::optional but I got some errors. I use c++17. platform_packages = toolchain-gccarmnoneeabi@~1.90301.0

src\MainTest\maintest.cpp:19:6: error: 'optional' in namespace 'std' does not name a template type
   19 | std::optional<int> opt{1};
      |      ^~~~~~~~
src\MainTest\maintest.cpp:19:1: note: 'std::optional' is only available from C++17 onwards
Indexing .pio\build\teensy36\lib63e\libHAL.a
   19 | std::optional<int> opt{1};
      | ^~~
src\MainTest\maintest.cpp:20:12: error: 'opt' was not declared in this scope
   20 | auto val = opt.value();
FrankBoesing commented 3 years ago

Teensy uses c++14

tech-alp commented 3 years ago

Well, When I using std::to_string, I got some errors. Are there relation? to_string come with c++11.

FrankBoesing commented 3 years ago

https://forum.pjrc.com/threads/66738-to_string()-doesn-t-work