Build_flags not recognizing -std=c++11 after updating nrf52DK platform


#1

I was working with Nordic52Dk board and mbed framework with -std=c++11 flag, but after updating the nordic library to version 2.4.1 my c++11 code suddenly stoped working, like
auto function() -> std::string
or
stoul()
and other c++11 related code.

I am using platformIO[3.6.1a4] extenension for VSCode.
In my c_cpp_properties i have:
“intelliSenseMode”: “clang-x64”,
“cStandard”: “c99”,
“cppStandard”: “c++98”,
“compilerPath”: “C:/Users/Ale/.platformio/packages/toolchain-gccarmnoneeabi/bin/arm-none-eabi-gcc.exe”

I have already tried the build_unflags = -std=c++98 but it didn’t work.


#2

It seems like downgrading to version 2.3.2 fixed the problem (as would spect), but i’d like to know if there is a solution to this problem anyway.
The 2.4.1 changelog says " * Use base flags if a framework is not specified"
Maybe that change broke something?


#3

Please provide platformio.ini.


#4

platformio.ini:

[env:nrf52_dk]
platform = nordicnrf52
board = nrf52_dk
framework = mbed
build_flags = -std=c++11 -D PIO_FRAMEWORK_MBED_RTOS_PRESENT

#5

mbed specifies own standard. You can check that with pio run -v. Use build_unflags to remove default mbed’s flags:

[env:nrf52_dk]
platform = nordicnrf52
board = nrf52_dk
framework = mbed
build_flags = -std=c++11 -D PIO_FRAMEWORK_MBED_RTOS_PRESENT
build_unflags = -std=gnu++98