MQTT - Mosquitto : C++, Qt 5.8, Windows 7. I need your help ;)
Since few days, I'm trying to develop my c++ client for windows (for subscribe and publish) without success...
So, I have tried to build and run examples found on GitHub, ... but again with no success.
For my project, I used headers & libraries from devel to mosquitto-1.4.12 and sample main.cpp that "implements" mosquittopp.h but i never succeed to run my program without instant crash.
Please help me, What files i forgot? What am I doing wrong? Have you got a working sample client for Qt and compil on Windows ? :)
i use Qt 5.8.0 MSVC 2015 x86 for build and run (but i can dowgrade if it's necessary)
Thanks so much for your answers!
Hi and welcome to devnet,
If your dependencies relie on .dll files, the you need to modify your Run environment PATH variable and add the path(s) containing these .dlls.
Hope it helps
What version is the devel dlls compiled with ( vs2013,2015 ?)
I can see the one for normal download is vs2013
mosquitto-1.4.12-install-win32.exe (~200 kB) (Native build, Windows Vista and up, built with Visual Studio Community 2013)
and you have 2015. So please check its same visual studio.
Also did you try the test cmdline programs?
to subscribe to a topic:
mosquitto_sub -t 'test/topic' -v
And to publish a message:
mosquitto_pub -t 'test/topic' -m 'hello world'
To test your installation is working.
as @SGaist says, if you did not install the normal packet, you might not have the
dlls in the right place/ to be found,
Running the cmdline tools should cast some light on that.
thank you so much for yours answers!
Today I achieved to run my program and to publish a message to the broker
- I have add my directory (with all mosquitto dlls) into the PATH
- i check the cmdlines and run it with success
- MSVC 2013 or 2015 works
- for the installation of mosquitto, i used the latest .exe on mosquitto.org
-> And in my .pro i made the links with the mosquitto libs
i share my .pro (if that can help other people)
QT += core network
QT -= gui
CONFIG += c++11
TARGET = MqttTest
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
LIBS += -L"$$PRO_FILE_PWD/libs/" -lmosquittopp
LIBS += -L"$$PRO_FILE_PWD/libs/" -lmosquitto
Where are you modifying PATH ?
Run environment PATH variable and add the path(s) containing these .dlls.