I have error Project ERROR: Unknown module(s) in QT: positioning when I'm trying to build QT5 dependent project with qmake, I suspect that problem can be in old QT4 installation that was installed before.
qmake -version
QMake version 3.0
Using Qt version 5.2.1 in /usr/lib/x86_64-linux-gnuSo my questions are:
1.How to resolve this error?
2.How to completelly remove Qt4 (and maybe reinstall QT5?)?
Update:
which qmake
/usr/bin/qmake
ls -l /usr/bin/qmake
lrwxrwxrwx 1 root root 9 апр. 4 2016 /usr/bin/qmake -> qtchooser
dpkg -l|grep qt5|grep qmake
ii qt5-qmake:amd64 5.2.1+dfsg-1ubuntu14.3 amd64 Qt 5 qmake Makefile generator tool
qt5-qmake
lots of output like /usr/lib/x86_64-linux-gnu/qt5/*
/usr/lib/x86_64-linux-gnu/qt5/bin
/usr/lib/x86_64-linux-gnu/qt5/bin/qmake
qtchooser -list-versions
4
5
default
qt4-x86_64-linux-gnu
qt4
qt5-x86_64-linux-gnu
qt5
qtchooser -print-env
QT_SELECT="default"
QTTOOLDIR="/usr/lib/x86_64-linux-gnu/qt5/bin"
QTLIBDIR="/usr/lib/x86_64-linux-gnu"After I set export QT_SELECT=qt5:
qtchooser -print-env
QT_SELECT="qt5"
QTTOOLDIR="/usr/lib/x86_64-linux-gnu/qt5/bin"
QTLIBDIR="/usr/lib/x86_64-linux-gnu"Also I have tried:
qtchooser -run-tool=qmake -qt=qt5 ../srcBut I still have same error.
3 Answers
You can install the development files for QT5 positioning module using this command:
sudo apt install qtpositioning5-devAlso make sure your system defaults to QT5 instead of QT4:
sudo apt install qt5-default You need to make sure to use qmake from Qt Version 5. This depends on you PATH Variable if you type in "qmake" in your Terminal.
The following steps may help you as an solution:
1. check the path of qmake for Qt Version 5 command: dpkg -l|grep qt5|grep qmake if you found the right name, see the details of the installed path: command: dpkg -L 2. set the path to qmake of Qt 5 in the right order command: export PATH=:$PATH 3. use qtchooser to switch between version of Qt development command: qtchooser -list-versions command: qtchooser -print-env command: qtchooser -qt=version have a look to "man qtchooser" !
Go to your source and run "qmake" again. You don't need to uninstall Qt4. You can more then one development Versions on your system.
1To resolve the Error
Project ERROR: Unknown module(s) in QT: positioningmake sure you have added
QT += positioning
to your .pro file. Please have a look also to form more configuration to use Qt Positioning C++ Classes