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 @douglas
2 Questions:
- did you rerun qmake after changing your .pro file?
- for what OS are you trying to make the program? serialport is not available for all platforms
-
wrote on 13 Jun 2018, 07:05 last edited by
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!
-
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!
- Which Qt version do you intend use?
- How did you install Qt? If you installed with apt, you may add the serialport module explicitely.
-
- Which Qt version do you intend use?
- How did you install Qt? If you installed with apt, you may add the serialport module explicitely.
-
Hi,
What @aha_1980 asked was whether you also installed the Qt5 SerialPort package using apt.
-
@aha_1980 I am using Qt 5.6.1. I installed Qt creator with apt. What do you mean with "add serialport explicitely"?
Thank you!wrote on 13 Jun 2018, 07:53 last edited by KillerSmath -
wrote on 13 Jun 2018, 07:57 last edited by
@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.
-
@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?wrote on 13 Jun 2018, 08:15 last edited by KillerSmath@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
-
-
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.
-
wrote on 13 Jun 2018, 08:28 last edited byThis post is deleted!
-
@douglas
In QtCreator go to Tools -> Options -> build & run and check your kitsIn sidebar under the "Projects tab" you can select one of your installed kits:
-
@douglas
In QtCreator go to Tools -> Options -> build & run and check your kitsIn sidebar under the "Projects tab" you can select one of your installed kits:
-
@douglas
from what one can see, it at least seems to be a version of Qt5, for more information press the "Manage kits" button -
@douglas
from what one can see, it at least seems to be a version of Qt5, for more information press the "Manage kits" buttonwrote on 13 Jun 2018, 09:34 last edited by@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. -
@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.
-
@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.
wrote on 13 Jun 2018, 10:07 last edited by@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. -
@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.@douglas Above you said you installed Qt 5.6, now you selected Qt 5.7.1
Which Qt version do you really want to use and did you install QtSearialPort for Qt 5.7.1?
11/58