2 years, 9 months ago.

Strange Compile Error of Eclipse Paho MQTT Client with mbed-os 5 3244:4c2560 - NonCopyable.h

When I try to compile the https://developer.mbed.org/teams/mqtt/code/HelloMQTT/ with actual mbed 5 3244:4c2560, I get following Error:

Error: "mbed::NonCopyable<T> &mbed::NonCopyable<T>::operator=(const mbed::NonCopyable<T> &) [with T=mbed::Timer]" (declared at <a href="#" onmousedown="mbed_doc_goto('/HelloMQTTextras/mbed-os.lib/platform/NonCopyable.h', '163'); return false;">/extras/mbed-os.lib/platform/NonCopyable.h:163</a>) is inaccessible in "extras/mbed-os.lib/drivers/Timer.h", Line: 50, Col: 24

extras/mbed-os.lib/platform/NonCopyable.h:163</a>) is inaccessible in "extras/mbed-os.lib/drivers/Timer.h" Is this a mbed-os 5 bug ???

How can it be fixed? Or how can I get MQTT compiled and running on my target?

1 Answer

2 years, 9 months ago.

Hello Martin,

In the MQTT library try to modify the MQTTmbed.h file as follows:

#if !defined(MQTT_MBED_H)
#define MQTT_MBED_H

#include "mbed.h"

class Countdown
    Countdown() {
        t = new Timer();   
    Countdown(int ms) {
        t = new Timer();
    ~Countdown() {
        delete t;
    bool expired() {
        return t->read_ms() >= interval_end_ms;
    void countdown_ms(unsigned long ms) {
        interval_end_ms = ms;
    void countdown(int seconds) {
        countdown_ms((unsigned long)seconds * 1000L);
    int left_ms() {
        return interval_end_ms - t->read_ms();
    Timer* t;
    unsigned long interval_end_ms; 


For explanation see https://developer.mbed.org/questions/78698/Program-for-STM32F411RE-wont-compile/.

Accepted Answer

Cool! Works! Thanks a lot Zoltan!

posted by Martin Heine 13 Aug 2017