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.
8 years, 2 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
8 years, 2 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
{
public:
Countdown() {
t = new Timer();
}
Countdown(int ms) {
t = new Timer();
countdown_ms(ms);
}
~Countdown() {
delete t;
}
bool expired() {
return t->read_ms() >= interval_end_ms;
}
void countdown_ms(unsigned long ms) {
t->stop();
interval_end_ms = ms;
t->reset();
t->start();
}
void countdown(int seconds) {
countdown_ms((unsigned long)seconds * 1000L);
}
int left_ms() {
return interval_end_ms - t->read_ms();
}
private:
Timer* t;
unsigned long interval_end_ms;
};
#endif
For explanation see https://developer.mbed.org/questions/78698/Program-for-STM32F411RE-wont-compile/.