安装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

© 2021 hanbaoaaa record.浙ICP备20005263号
asdad
联系方式 asdasd
2021-5-8 4:19
sss
回复数 (0) 点击展开
加载更多

新增评论

称呼
联系方式
邮箱(选填)
内容

提交

取消