Installed library is not seen in Qt Creator
-
Hi there,
I started in Qt some10 years ago for my internship. And now I am starting again.
I have a question. I am trying to install and use QtSerialPort library. I asked chatGpt first, it said: use the Qt maintenance tool, So I did and there are checks that the library is installed.

But when I include the library. -> not found

I was looking my system

I can find a header file, though no CPP.Anyways. Chad is not helping me further, so the question:
How do I make use of the QSerialPort library?{noformat}
Qt 6.10.1 (x86_64-little_endian-llp64 shared (dynamic) release build; by MSVC 2022) on "windows"
OS: Windows 10 Version 22H2 [winnt version 10.0.19045]Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2 RDRAND RDSEED AES
Kind regards,
Bas
-
Hi,
Did you adjust your
.proorCMakeLists.txtfile to make use of that module ? -
No I had not, I lasked chad what to with it. It did tell me before to change this file, but I didn't trust the output.
I added
Qt${QT_VERSION_MAJOR}::SerialPortunder target_linkAnd I changed this
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)in
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets SerialPort) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets SerialPort)Now it seems to compile
I do think this is somewhat... complicated. I could not have figured this out myself. We got a fancy maintenance tool, you would think that with something like that, you would not have to edit make files yourself?
I also read on Qt docs you could right click in your project viewer and click 'add library'. I could not find that button.
Kind regards,
Bas
-
B bask185 has marked this topic as solved
-
I encourage you to go to the QSerialPort documentation.
It's a the top of the page.
Installing a module and making use of it in your project are two very different things. There's no reason for the installer nor the maintenance tool to go affect your projects.
The "adding a library" part is for non Qt modules.