I have problems compiling an mqtt example working fine on the mbed ide but not on platform io
I get the following errors:
ret = sock.connect("192.168.2.4",1883);
^
In file included from src\main.cpp:4:0:
lib\MQTT/MQTTClient.h: In instantiation of 'int MQTT::Client<Network, Timer, MAX_MQTT_PACKET_SIZE, MAX_MESSAGE_HANDLERS>::yield(long unsigned int) [with Network = MQTTSocket; Timer = Countdown; int MAX_MQ
TT_PACKET_SIZE = 100; int MAX_MESSAGE_HANDLERS = 5]':
src\main.cpp:103:29: required from here
lib\MQTT/MQTTClient.h:507:25: error: use of deleted function 'Countdown::Countdown(Countdown&&)'
Timer timer = Timer();
^
In file included from lib\MQTT/MQTTSocket.h:4:0,
from src\main.cpp:3:
lib\MQTT/MQTTmbed.h:6:7: note: 'Countdown::Countdown(Countdown&&)' is implicitly deleted because the default definition would be ill-formed:
class Countdown
^~~~~~~~~
lib\MQTT/MQTTmbed.h:6:7: error: use of deleted function 'mbed::Timer::Timer(const mbed::Timer&)'
In file included from C:\Users\cmeinert\.platformio\packages\framework-mbed/mbed.h:93:0,
from src\main.cpp:1:
C:\Users\cmeinert\.platformio\packages\framework-mbed/drivers/Timer.h:51:7: note: 'mbed::Timer::Timer(const mbed::Timer&)' is implicitly deleted because the default definition would be ill-formed:
class Timer : private NonCopyable<Timer> {
^~~~~
C:\Users\cmeinert\.platformio\packages\framework-mbed/drivers/Timer.h:51:7: error: 'mbed::NonCopyable<T>::NonCopyable(const mbed::NonCopyable<T>&) [with T = mbed::Timer]' is private within this context
In file included from C:\Users\cmeinert\.platformio\packages\framework-mbed/rtos/Thread.h:31:0,
from C:\Users\cmeinert\.platformio\packages\framework-mbed/rtos/rtos.h:29,
from C:\Users\cmeinert\.platformio\packages\framework-mbed/mbed.h:38,
from src\main.cpp:1:
C:\Users\cmeinert\.platformio\packages\framework-mbed/platform/NonCopyable.h:157:5: note: declared private here
NonCopyable(const NonCopyable&);
^~~~~~~~~~~
*** [.pioenvs\nucleo_l476rg\src\main.o] Error 1
Any results … I need urgently a solution to use MQTT together with a W5500 on STM32.
Tried may librarians and examples but allways have problems with the necessary rtos part during compilation. Thank you for your help.
I just removed the following define from platformio.ini file:
-D PIO_FRAMEWORK_MBED_RTOS_PRESENT
and compiled your code successfully with command pio run:
Calculating size .pioenvs/nucleo_l476rg/firmware.elf
text data bss dec hex filename
76808 2536 1708 81052 13c9c .pioenvs/nucleo_l476rg/firmware.elf
But even with -D PIO_FRAMEWORK_MBED_RTOS_PRESENT I do not see same errors like you:
.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/lib/thumb/v7e-m/fpv4-sp/softfp/crt0.o: In function `_start':
(.text+0x4a): undefined reference to `__wrap_main'
.pioenvs/nucleo_l476rg/FrameworkMbedCore/drivers/SPI.o: In function `mbed::SPI::lock()':
SPI.cpp:(.text._ZN4mbed3SPI4lockEv+0x10): undefined reference to `osMutexAcquire'
SPI.cpp:(.text._ZN4mbed3SPI4lockEv+0x1c): undefined reference to `rtos::Mutex::Mutex()'
SPI.cpp:(.text._ZN4mbed3SPI4lockEv+0x24): undefined reference to `osMutexRelease'
SPI.cpp:(.text._ZN4mbed3SPI4lockEv+0x3c): undefined reference to `singleton_mutex_id'
SPI.cpp:(.text._ZN4mbed3SPI4lockEv+0x32): undefined reference to `rtos::Mutex::lock(unsigned long)'
.pioenvs/nucleo_l476rg/FrameworkMbedCore/drivers/SPI.o: In function `mbed::SPI::unlock()':
SPI.cpp:(.text._ZN4mbed3SPI6unlockEv+0x10): undefined reference to `osMutexAcquire'
SPI.cpp:(.text._ZN4mbed3SPI6unlockEv+0x1c): undefined reference to `rtos::Mutex::Mutex()'
SPI.cpp:(.text._ZN4mbed3SPI6unlockEv+0x24): undefined reference to `osMutexRelease'
SPI.cpp:(.text._ZN4mbed3SPI6unlockEv+0x38): undefined reference to `singleton_mutex_id'
SPI.cpp:(.text._ZN4mbed3SPI6unlockEv+0x2e): undefined reference to `rtos::Mutex::unlock()'
.pioenvs/nucleo_l476rg/FrameworkMbedCore/platform/mbed_wait_api_rtos.o: In function `wait_us':
mbed_wait_api_rtos.cpp:(.text.wait_us+0x36): undefined reference to `rtos::Thread::wait(unsigned long)'
After this I get the following Error during pio run:
rrException in thread Thread-3:
Traceback (most recent call last):
File "C:\Python27\Lib\threading.py", line 801, in __bootstrap_inner
self.run()
File "c:\users\cmeinert\.platformio\penv\lib\site-packages\platformio\util.py", line 92, in run
self.outcallback(line)
File "c:\users\cmeinert\.platformio\penv\lib\site-packages\platformio\managers\platform.py", line 396, in on_run_err
self._echo_line(line, level=3 if is_error else 2)
File "c:\users\cmeinert\.platformio\penv\lib\site-packages\platformio\managers\platform.py", line 413, in _echo_line
click.secho(line, fg=fg, err=level > 1)
File "c:\users\cmeinert\.platformio\penv\lib\site-packages\platformio\__main__.py", line 114, in <lambda>
click.secho = lambda *args, **kwargs: _safe_echo(1, *args, **kwargs)
File "c:\users\cmeinert\.platformio\penv\lib\site-packages\platformio\__main__.py", line 111, in _safe_echo
sys.stdout.write)("%s\n" % (args[0] if args else ""))
IOError: [Errno 0] Error
and then it stop (no further response) after the last line (WIZnetInterface.o)
After this everything is the same as in my last reply.
I don’t know exact locations on Windows.
Try to delete .platformio from your user profile directory to clean up all installed frameworks, toolchains etc