Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt Creator adding mqtt library

Tags:

c++

qt

mqtt

Working on Win 10 with QT Creator 4.3.1 Trying to add a library to my qt project via the GUI. In specific the qtmqtt library.

right click on project -> "Add library..." and simply nothing happens.

Anybody else having this problem?

Seems like I am to stupid to add a library directory via the .pro file. Googled for hours but cant get my head around it. So I really need the GUI solution to be working.

like image 277
FuzzyTemper Avatar asked Feb 09 '18 08:02

FuzzyTemper


2 Answers

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.

like image 117
p-a-o-l-o Avatar answered Sep 22 '22 02:09

p-a-o-l-o


try this step by step :

//emqttd boker

git clone https://github.com/emqtt/qmqtt.git

//Qt mqtt

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

cd qmqtt
mkdir build
cd build

//Untubu

~/Qt/5.10.0/gcc_64/bin/qmake qmake -r ..

//mac Os

~/Qt/5.10.0/clang_64/bin/qmake qmake -r ..

make
sudo make install

Done

like image 37
Ivan Dimtry Avatar answered Sep 24 '22 02:09

Ivan Dimtry