Solved Use MQTT on QT version 4.8.6
-
Hello
I was wondering if it is possible to use MQTT somehow on QT version 4.8.6 ?
If it's possible can someone please guide me with the steps involved ?
Sorry I am new to QT & programming in general, so any help is appreciated.
Thanks -
@confusedNerd
QtMQTT module is only available in Qt 5. Why do you still have to use Qt4?
Beside that its always possible to use a 3rd party lib, like libmosquitto.Sorry I am new to QT & programming in general, so any help is appreciated.
not the best task to start programming to be honest.
-
@raven-worx
Thanks for the heads up. I have installed QT 5.15 but i am still facing some issuesI tried installing QT module using following steps
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
mingw32-make
mingw32-make installHowever after mingw32-make I am getting follwing error
C:\Qt_5.15\qtmqtt>mingw32-make
cd src/ && ( test -e Makefile || C:/Qt_5.15/5.15.2/mingw81_64/bin/qmake.exe -o Makefile C:/Qt_5.15/qtmqtt/src/src.pro ) && mingw32-make -f Makefile
mingw32-make[1]: Entering directory 'c:/Qt_5.15/qtmqtt/src'
cd mqtt/ && ( test -e Makefile || c:/Qt_5.15/5.15.2/mingw81_64/bin/qmake.exe -o Makefile C:/Users/zbgtmn/qtmqtt/src/mqtt/mqtt.pro ) && C:/MinGW/bin/mingw32-make -f Makefile
mingw32-make[2]: Entering directory 'c:/Qt_5.15/qtmqtt/src/mqtt'
C:/MinGW/bin/mingw32-make -f Makefile.Release
mingw32-make[3]: Entering directory 'c:/Qt_5.15/qtmqtt/src/mqtt'
g++ -c -fno-keep-inline-dllexport -O2 -g -std=c++1z -fno-exceptions -Wall -Wextra -Wextra -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -DUNICODE -D_UNICODE -DWIN32 -DMINGW_HAS_SECURE_API=1 -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 -DQT_NO_LINKED_LIST -DQT_NO_FOREACH -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_MQTT_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_DEPRECATED_WARNINGS_SINCE=0x060000 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I. -I../../include -I../../include/QtMqtt -I../../include/QtMqtt/6.1.0 -I../../include/QtMqtt/6.1.0/QtMqtt -Itmp -IC:/Qt_5.15/5.15.2/mingw81_64/include -IC:/Qt_5.15/5.15.2/mingw81_64/include/QtNetwork -IC:/Qt_5.15/5.15.2/mingw81_64/include/QtCore/5.15.2 -IC:/Qt_5.15/5.15.2/mingw81_64/include/QtCore/5.15.2/QtCore -IC:/Qt_5.15/5.15.2/mingw81_64/include/QtCore -I.moc/release -IC:\openssl\include -IC:\Utils\my_sql\mysql-5.7.25-winx64\include -IC:\Utils\postgresql\pgsql\include -IC:/Qt_5.15/5.15.2/mingw81_64/mkspecs/win32-g++ -o .obj/release/qmqttconnection.o qmqttconnection.cpp
qmqttconnection.cpp: In member function 'void QMqttConnection::finalize_connack()':
qmqttconnection.cpp:1452:26: error: 'class QList<QMqttTopicName>' has no member named 'resize'; did you mean 'size'?
m_receiveAliases.resize(m_clientPrivate->m_serverConnectionProperties.maximumTopicAlias());
^~~~~~
qmqttconnection.cpp:1453:26: error: 'class QList<QMqttTopicName>' has no member named 'resize'; did you mean 'size'?
m_publishAliases.resize(m_clientPrivate->m_connectionProperties.maximumTopicAlias());
^~~~~~
At global scope:
cc1plus.exe: warning: unrecognized command line option '-Wno-stringop-overflow'
Makefile.Release:991: recipe for target '.obj/release/qmqttconnection.o' failed
mingw32-make[3]: *** [.obj/release/qmqttconnection.o] Error 1
mingw32-make[3]: Leaving directory 'c:/Qt_5.15/qtmqtt/src/mqtt'
Makefile:45: recipe for target 'release' failed
mingw32-make[2]: *** [release] Error 2
mingw32-make[2]: Leaving directory 'c:/Qt_5.15/qtmqtt/src/mqtt'
Makefile:49: recipe for target 'sub-mqtt-make_first' failed
mingw32-make[1]: *** [sub-mqtt-make_first] Error 2
mingw32-make[1]: Leaving directory 'c:/Qt_5.15/qtmqtt/src'
Makefile:51: recipe for target 'sub-src-make_first' failed
mingw32-make: *** [sub-src-make_first] Error 2Any help is appreciated
-
Why do you double post your issues? Closed!