Compiling with C++14 - EspressIf library fails

I’d like to use some C++14 features in my code, and have changed the compilation flags as follows:

build_unflags = -std=gnu++11
build_flags = -std=c++14

Unfortunately one of the EspressIf libraries fails with this error message:

Compiling .pio/build/esp32dev/libf73/WebServer/detail/mimetable.cpp.o /home/xxx/.platformio/packages/framework-arduinoespressif32/libraries/FS/src/vfs_api.cpp: In member function ‘virtual void VFSFileImpl::flush()’: /home/xxx/.platformio/packages/framework-arduinoespressif32/libraries/FS/src/vfs_api.cpp:349:20: error: ‘fileno’ was not declared in this scope fsync(fileno(_f));

Has anyone found a way around this, or could suggest some options to try? Is it possible to compile partly with and partly without C++14 support?

I’d just recommend using the 3 lines of platformio.ini instructions in the two posts ESP32-Arduino - platformio support for 2.0.0 version to get a 2.0.0 core beta version. They updated their code to C++17 without you having to do any build_flags modifications, so for sure the C++14 things you need are also there.

Technically yes, see Redirecting.... You can, via scripting, modify env["CXXFLAGS"] for specific source files to something else.

Very cool - thank you!