Problems when adding serialport module in Qt project
-
Hi,
I need to use QSerialport in my Qt project. Following the official documentation, I addedQT += serialport
to my .pro file. After doing this, the build always fails, giving the error: "Unknown module(s) in QT: serialport". I am using Qt Creator 4.1.0 based on Qt 5.6.1. What am I missing?
Thank you. -
Hi,
when I run qmake (Build menu -> Run qmake), I get the same error. I am trying to build an application for a device running Linux Yocto, and my host PC, in which Qt Creator is installed, has Uuntu 16.04 as O.S.
My .pro file first lines looks like the following:QT += core gui printsupport QT += serialport
Thank you!
-
@KillerSmath I installed those packages via Software Center. Perhaps have I to uninstall them and re-install via apt-get?
Could it be the reason for the "unknown module" error? -
Silly question: are you sure you are using Qt 5 and not Qt 4 for your project ?
-
That's just the information about Qt Creator.
You have to check the Kit you are using to build your application and which version of Qt it is using.
-
@douglas
If nothing works, you can try to manage the packages from MaintenanceTool of QtCreator-
- <Qt Folder>/MaintenanceTool
-
- Add or remove Components
-
- Expand your Qt version
-
- Expand Source Components
-
- Select the Qt Source Package
-
- Next, Install
-
-
This post is deleted!
-
@J.Hilk The Manage Kit button shows the settings reported below, in which I can't find any information regarding the Qt version in use:
If from terminal I write
$ qmake --version
I obtain the following:
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory
Is it relevant the "qt4" shown in that prompt?
Thanks. -
@douglas
well, there we have your problemyou have no QtLibary selected to your kit. Se if you can actually select a QtVersion from that dropdown menu. If you can't than you need to install an actual qt version.
I would recommend the online installer from the Webside.
-
@J.Hilk Thanks, I added the version as shown below:
Now, since I should have Qt5, I added the serialport support in my .pro file, but the "unknow module" error still remains. I saw another thing that seems not so clear to me: I run Qt Creator from linux terminal, and when I open my project the terminal shows the following lines, marked in red, in which appears Qt4. Can this be related to the serialport module error?
thank you again.