安装qt module (以qtmqtt为例

According to this, there’s no need to add libraries, since MQTT is a Qt module just add this line in your pro file:

QT += mqtt

To use a Qt module, it must be installed in the Qt lib directory.

First, retrieve the lib directory path executing this command from a terminal:

qmake -query QT_INSTALL_LIBS

Cd into that directory and check if a file called Qt5Mqtt.dll is there: if not, you must build/install the module.

To get the module source code, you can execute this git command:

git clone git://code.qt.io/qt/qtmqtt.git

Once you have the source files, cd into the source files directory containing the file qtmqtt.pro and run these commands:

qmake
make
make install

(you may need administrator privileges for the last one).

After the commands completed successfully, you should be able to see the library in the QT_INSTALL_LIBS directory, and use the module in a Qt project.

In case of compilation issues, open the qtmqtt.pro file with creator, and try to build the library from there, then manually install (copy) it into the QT_INSTALL_LIBS.

上面内容是从stack overflow上找到的。亲测可用

我就做一些注解吧

一个是命令行需要有qt 环境。win下的话有专门配好环境的命令行

image-20201213055938799

然后需要右键以管理员身份运行这个命令行。否则无法进行make install

还有一个注意点是注意版本。git clone之前去官网看一下有哪些分支,

像我的是5.12,所以要加上–branch 5.12

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值