In file included from src\BoxLCD.cpp:1:0:
include/BoxLCD.h:7:17: fatal error: cmath: No such file or directory
compilation terminated.
*** [.pio\build\teensy2\src\BoxLCD.cpp.o] Error 1
I’m not trying to do anything fancier, I just want to use the pow() function!..
#include <cmath>
Nevertheless the PlatformIO seems to work exclusively like the old school C++!
PlatformIO gives you the same compiler and C++ standard the Arduino IDE wuold give you when compiling for that core, this is the only way to maintain compatibility.
The Teensy 2 is a AVR based board a d uses a by default 5.4.1 avr-gcc, which I heavily doubt is capable of C++17. Also the AVR-GCC compilers are known for not supporting a whole lot of C++ standard library features, even in more recent versions.
So that, even with
[env:teensy2]
platform = teensy
board = teensy2
framework = arduino
build_unflags = -fno-exceptions -std=gnu++11
build_flags = -D USB_MIDI -D TEENSY_OPT_FASTEST -fexceptions -std=gnu++17
; use a more recent 7.3.0 compiler instead of 5.4.1
platform_packages =
toolchain-atmelavr@~3.70300.
So the only sensible thing I can recommend is to stick with the defaults, forget about using standards beyond C++11 or the C++ standard library on an AVR processor, and just use #include <math.h> instead of #include <cmath>. It has pow() and that compiles.