Qt5.12.2 add mqtt module


Download the mqtt Qt submodule

https://download.qt.io/official_releases/qt/5.15/5.15.4/submodules/

Unzip after downloading:

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-1ZJ4GR5B-1663379996037)(en-resource://database/1276:1)]

Use Qt to compile modules and install to generate dynamic libraries

qtcreator opens the pro project file under the decompressed qtmqtt source code

Choose the qt5.12.2 mingw compiler, and choose 32-bit or 64-bit according to your usage:

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-FgYrXgbe-1663379996038)(en-resource://database/1278:1)]

In the project configuration, add the install parameter to make:

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-Ru0fk42a-1663379996038)(en-resource://database/1280:1)]

Then build and compile

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-mwI5Uns8-1663379996038)(en-resource://database/1282:1)]

After successful success, the mqtt library and header files will be automatically generated in the Qt installation directory

insert image description here

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-NCymc0mj-1663379996039)(en-resource://database/1286:1)]

At this time, after creating a new project, add QT += mqtt in .pro and it can be used normally

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-PuIpJ2hy-1663379996039)(en-resource://database/1288:1)]

Guess you like

Origin blog.csdn.net/qq_37596943/article/details/126901699