ARMmbed / mbed-os-example-blinky

Blinky example for Mbed OS 6.0
Apache License 2.0
42 stars 157 forks source link

ThisThread::sleep_for(var) issue #239

Closed JaMinsane closed 3 years ago

JaMinsane commented 3 years ago

When I imported the source code into mbedOS online compiler and then tried to compile. I got this error:

*Error: No matching literal operator for call to 'operator""ms' with argument of type 'unsigned long long' or 'const char ', and no matching literal operator template in "main.cpp", Line: 20, Col: 31**

I didn't change anything but It can't compile.

main.cpp

/* mbed Microcontroller Library
 * Copyright (c) 2019 ARM Limited
 * SPDX-License-Identifier: Apache-2.0
 */

#include "mbed.h"

// Blinking rate in milliseconds
#define BLINKING_RATE     500ms

int main()
{
    // Initialise the digital pin LED1 as an output
    DigitalOut led(LED1);

    while (true) {
        led = !led;
        ThisThread::sleep_for(BLINKING_RATE);
    }
}
ciarmcom commented 3 years ago

Thank you for raising this detailed GitHub issue. I am now notifying our internal issue triagers. Internal Jira reference: https://jira.arm.com/browse/IOTOSM-2045

michaelbzhu commented 3 years ago

I got the same error, but it compiled for me when I removed the "ms" from the BLINKING_RATE

Changed: #define BLINKING_RATE 500ms to #define BLINKING_RATE 500

rajkan01 commented 3 years ago

Hi James, Thanks for reporting the issue. This issue caused by mbed import mbed-os-example-blinky command which gets invoked at the time of importing the source code into mbedOS online compiler, import command is importing an old version of mbed-os-5.15.4 instead of the latest released version. As the Chrono C++ functionality of passing Chrono duration like time with ms (500ms) suffix support is available from mbed-os-6.0.0.

Already we have an internal ticket https://jira.arm.com/browse/IOTOSM-278 to investigate mbed import command issue.

I will update here, once I have some information on the progress of that issue.

Thanks

evedon commented 3 years ago

I will close this as I believe your question was answered.