Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
3 years, 4 months ago. This question has been closed. Reason: Off Topic
How to deal with 'function does not support cv-qualifiers'?
I'm trying to compile a 3rd party application for a Nucleo_L073RZ using mbed-os, which tries to attach a class member function to an mbed Timer, as follows:
rxTimeoutTimer.attach_us( this, &SX1276::OnTimeoutIrq, timeout );
This generates a compiler warning that could be the cause of the application failing in strange ways:
[Warning] sx1276.cpp@919,71: 'void mbed::Ticker::attach_us(T*, M, timestamp_t) [with T = SX1276; M = void (SX1276::*)(); timestamp_t = long unsigned int]' is deprecated: The attach_us function does not support cv-qualifiers. Replaced by attach_us(callback(obj, method), t). [since mbed-os-5.1] [-Wdeprecated-declarations]
I'd really appreciate if somebody can suggest a possible workaround.
Belatedly realised that the error is just relating to the syntax which should be: rxTimeoutTimer.attach_us(callback(this, &SX1276::OnTimeoutIrq), timeout );
3 years, 4 months ago.
According to Ticker.h, the object and method should now be wrapped in a callback<>:
rxTimeoutTimer.attach_us( callback(this, &SX1276::OnTimeoutIrq), timeout );