Hi all,
I have warning:
Warning: 'sleep_for' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use
5s
rather than
5000
. [since mbed-os-6.0.0] [-Wdeprecated-declarations] in "main.cpp",
If I use Online Compiler :
ThisTread:sleep_for(5s);
it build with out warning.
but offline build GCC_ARM trow an error that it does not recognize ‘s’.
mbed-os is on versinion 6.x
Thanks for advices
I don’t know how about other revisions but with the
gcc-arm-none-eabi-9-2019-q4-major
the
chrono
literals like
5s
work fine. And I expect it should be the same with newer revisions. Maybe you just left a space char between the number and the ‘s’ char, like
5 s
. Since I use a code beautifier (which is not aware of those special literals) I also frequently have to fix such errors manually.
In
mbed-os 6.x
, you can resolve the warnings by including the following at the top of your source file after the
#includes
.
using namespace std;