6 years, 7 months ago.

mbed-os version conflicts with included libraries

Hello,

as a rather mbed-newby I have played around with exporting programs to an external IDE (Visual Code, Ubuntu, GNU Arm Embedded Toolchain).

After fixing some issues with the exported configuration (settings.json, tasks.json), my "Hello World" samples worked fine.

When including existing libraies (e.g. MQTT - https://os.mbed.com/teams/mqtt/code/MQTT/) the compiler fails due to missing includes (e.g. TCPSocketConnection.h - https://os.mbed.com/users/mbed_official/code/Socket/docs/434906b5b977/TCPSocketConnection_8h_source.html)

It seems that TCPSocketConnection has been removed in mbed-os version 5. Is this an issue specific to this library (MQTT). Or did I missed some settings while exporting the programm (compiling within the online IDE works fine).

Thx, Thomas

some additional information

mbed commands

mbed import mbed-os-example-blinky
mbed add http://mbed.org/teams/mqtt/code/MQTT/
mbed export -i vscode_gcc_arm -m K64F

the mbed-cli export command generates a valid Visual Code configuraiton (the online-compiler exports an invalid one)

adopted main.cpp

#include "MQTTEthernet.h"
#include "MQTTmbed.h"
#include "MQTTClient.h"

// main() runs in its own thread in the OS
int main() {
   
}

compiler output

Compile: main.cpp
In file included from .././MQTT/MQTTEthernet.h:7:0,
                 from ../main.cpp:1:
.././MQTT/MQTTSocket.h:5:33: fatal error: TCPSocketConnection.h: No such file or directory
 #include "TCPSocketConnection.h"
                                 ^
compilation terminated.
posted by Thomas Kriechbaum 16 Sep 2017

Which version of mbed-os are you using?

posted by the other jimmy 18 Sep 2017

1 Answer

6 years, 7 months ago.

The MQTT library was written based on Mbed 2 and there are some differences in networking between Mbed 2 and Mbed OS 5. This blog post notes how to get MQTT started for Mbed OS5. https://os.mbed.com/blog/entry/Using-HTTP-HTTPS-MQTT-and-CoAP-from-mbed/

Thanks for the details about exporting from online and offline. We'll take a look into this.