QtMqtt Installation fatal error: private/qobject_p.h: No such file or directory
-
While installing QtMqtt Library I am facing the error message as shown below.
Stes followed:- clone nearest branch. ( Cloned successfully)
- qmake (Qmake completed and makefile got created)
- make (Make shows the errors)
In file included from /home/ashraful/work_temp/qtmqtt/src/mqtt/qmqttclient.cpp:31:0:
/home/ashraful/work_temp/qtmqtt/src/mqtt/qmqttclient_p.h:49:10: fatal error: private/qobject_p.h: No such file or directory
#include <private/qobject_p.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:541: recipe for target '.obj/qmqttclient.o' failed
make[2]: *** [.obj/qmqttclient.o] Error 1I tried to locate the qobject_p.h but there were no such file on my system. I am using ubuntu 18.04LTS.
As mentioned in the text I have tried to clone the nearest branch but it didnt work.
Error Details:
cd src/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /home/ashraful/work_temp/qtmqtt/src/src.pro ) && make -f Makefile
make[1]: Entering directory '/home/ashraful/work_temp/qtmqtt/build/src'
cd mqtt/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /home/ashraful/work_temp/qtmqtt/src/mqtt/mqtt.pro ) && make -f Makefile
Project MESSAGE: perl -w /usr/lib/qt5/bin/syncqt.pl -module QtMqtt -version 5.10.0 -outdir /home/ashraful/work_temp/qtmqtt/build /home/ashraful/work_temp/qtmqtt
<srcbase> = /home/ashraful/work_temp/qtmqtt
<outbase> = /home/ashraful/work_temp/qtmqtt/build
QtMqtt: created fwd-include header(s) for <srcbase>/src/mqtt/ { qmqttclient.h (2), qmqttclient_p.h (1), qmqttconnection_p.h (1), qmqttcontrolpacket_p.h (1), qmqttglobal.h (1), qmqttmessage.h (2), qmqttsubscription.h (2), qmqttsubscription_p.h (1), qmqtttopicfilter.h (2), qmqtttopicname.h (2) }
QtMqtt: created version header
QtMqtt: created master header
QtMqtt: created headers.pri file
make[2]: Entering directory '/home/ashraful/work_temp/qtmqtt/build/src/mqtt'
perl /usr/lib/x86_64-linux-gnu/qt5/mkspecs/features/data/unix/findclasslist.pl < QtMqtt.version.in > QtMqtt.version
g++ -g -O2 -fdebug-prefix-map=/build/qtbase-opensource-src-HhiYiB/qtbase-opensource-src-5.9.5+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -D_REENTRANT -fPIC -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_MQTT_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I/home/ashraful/work_temp/qtmqtt/src/mqtt -I. -I../../include -I../../include/QtMqtt -I../../include/QtMqtt/5.10.0 -I../../include/QtMqtt/5.10.0/QtMqtt -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.9.5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.9.5/QtCore -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I.moc -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -x c++-header -c ../../include/QtMqtt/QtMqttDepends -o .pch/Qt5Mqtt.gch/c++
g++ -c -include .pch/Qt5Mqtt -g -O2 -fdebug-prefix-map=/build/qtbase-opensource-src-HhiYiB/qtbase-opensource-src-5.9.5+dfsg=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -O2 -std=c++1z -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -W -Wvla -Wdate-time -Wshift-overflow=2 -Wduplicated-cond -Wno-stringop-overflow -D_REENTRANT -fPIC -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_MQTT_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG -DQT_NETWORK_LIB -DQT_CORE_LIB -I/home/ashraful/work_temp/qtmqtt/src/mqtt -I. -I../../include -I../../include/QtMqtt -I../../include/QtMqtt/5.10.0 -I../../include/QtMqtt/5.10.0/QtMqtt -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtNetwork -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.9.5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore/5.9.5/QtCore -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I.moc -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o .obj/qmqttclient.o /home/ashraful/work_temp/qtmqtt/src/mqtt/qmqttclient.cpp
In file included from /home/ashraful/work_temp/qtmqtt/src/mqtt/qmqttclient.cpp:31:0:
/home/ashraful/work_temp/qtmqtt/src/mqtt/qmqttclient_p.h:49:10: fatal error: private/qobject_p.h: No such file or directory
#include <private/qobject_p.h>
^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Makefile:541: recipe for target '.obj/qmqttclient.o' failed
make[2]: *** [.obj/qmqttclient.o] Error 1
make[2]: Leaving directory '/home/ashraful/work_temp/qtmqtt/build/src/mqtt'
Makefile:44: recipe for target 'sub-mqtt-make_first' failed
make[1]: *** [sub-mqtt-make_first] Error 2
make[1]: Leaving directory '/home/ashraful/work_temp/qtmqtt/build/src'
Makefile:46: recipe for target 'sub-src-make_first' failed
make: *** [sub-src-make_first] Error 2 -
Hi and welcome to devnet,
Since you are building for your distribution provided Qt, you need to install the corresponding private-dev package. From the looks of it, the one for qtbase should be enough.