Unable to find numeric literal operator 'operator""ms'

Hello. It used to be that ThisThread::sleep_for needed an annotated integral type. However a new project I’ve created in the same way as another older (as in months older, not years) project gets a compilation error when I pass e.g. 100ms.

Has anyone encountered this? I’d like to trace down the compiler problem I am having before it starts causing issues.

the chrono constants were introduced with Mbed6.
The problem is now with libraries that may use now different constants.

There are some ways to handle wait functions with 6.7, normally they use literals from the chrono library for ms or s, (us doesn’t work!):
thread_sleep_for(5ms) this should used for bare metal I think
for pass a variable you need do this:
int delay = 500; ThisThread::sleep_for(chrono::milliseconds(delay));
following should also work
wait_us(delay); wait_ms is deprecated

So many old libraries doesn’t work anymore, what a shame.

Hi Johannes/Stefan,

I’m aware of how the constants work and quite like it. My issue is that when I made projects a few months ago, I needed to use chrono typed literals. Now I am getting an error if I add the ms suffix as in the title.

I’m unable to tell how my toolchain changed. I’m using the latest 10.x gcc release instead of the 9.x release.

it shouldn’t be a matter of the toolchain, have you tried to upgrade the older project? What Mbed version is the older project using?

You are probably missing a “using namespace `std::literals::chrono_literals” somewhere.

using namespace std::literals::chrono_literals