adding new class in Qt Creator
-
Hi everyone,
as quite a newbee I feel especially stupid now:
wanting to work with QSerialPort I find that Qt Creator does not know it. When I try to #include, I get "file not found".
Searching the web did not lead me to a solution.
Can anybody help me on how to include that module into my setup?
Thank you
Michael -
Hi everyone,
as quite a newbee I feel especially stupid now:
wanting to work with QSerialPort I find that Qt Creator does not know it. When I try to #include, I get "file not found".
Searching the web did not lead me to a solution.
Can anybody help me on how to include that module into my setup?
Thank you
Michael@herrgross
yo need to include the package to the projectto use the #include <QSerialPort>
if you are using CMake:
you need to add the:find_package(Qt6 REQUIRED COMPONENTS SerialPort) target_link_libraries(mytarget PRIVATE Qt6::SerialPort)
if you are using qmake
you need to addqmake: QT += serialport
you can see what you need in the initial table of every class description
-
@herrgross
yo need to include the package to the projectto use the #include <QSerialPort>
if you are using CMake:
you need to add the:find_package(Qt6 REQUIRED COMPONENTS SerialPort) target_link_libraries(mytarget PRIVATE Qt6::SerialPort)
if you are using qmake
you need to addqmake: QT += serialport
you can see what you need in the initial table of every class description
@Sebastiano-Zamberlan I am using QMake, but adding serialport port in the .pro file like this:
QT += core gui serialport
gives me "Project ERROR: Unknown module"
-
@Sebastiano-Zamberlan I am using QMake, but adding serialport port in the .pro file like this:
QT += core gui serialport
gives me "Project ERROR: Unknown module"
@herrgross said in adding new class in Qt Creator:
Project ERROR: Unknown module"
and the unknown module is serialport?
How did you install Qt? -
@Sebastiano-Zamberlan I am using QMake, but adding serialport port in the .pro file like this:
QT += core gui serialport
gives me "Project ERROR: Unknown module"
check with Qt Maintenance tool if you add the library "Serial Port" of your current Qt release, you find it under "additional libraries"
-
@herrgross said in adding new class in Qt Creator:
Project ERROR: Unknown module"
and the unknown module is serialport?
How did you install Qt? -
@jsulm yes, unknown module serialport.
What do you mean by "how did you install"?
I'm on a Mac, installed from the Qt webpage@herrgross said in adding new class in Qt Creator:
What do you mean by "how did you install"?
I mean exactly what I asked.
There are different ways to install Qt.
If you installed using the online installer then follow what @Sebastiano-Zamberlan suggested. -
@herrgross said in adding new class in Qt Creator:
What do you mean by "how did you install"?
I mean exactly what I asked.
There are different ways to install Qt.
If you installed using the online installer then follow what @Sebastiano-Zamberlan suggested.