The installation of QT6 serial port module QSerialport is mainly a "compiler" version issue

Reference documentation

https://blog.csdn.net/lidandan2016/article/details/85929069
https://blog.csdn.net/qq_42968012/article/details/126020554
https://blog.csdn.net/weixin_48467622/article/details/119982667

Summary of overall test solution steps

First of all, QT6 cannot be installed offline and can only be installed online. You can search by yourself during the installation process. By default, QT6 does not come with the serial port module QSerialport . Therefore, you need to download the lower version of the QSerialport project file and then install it into QT6creator. The most important one is the MinGW version of the compiler of the project file.
The overall solution requires two parts: 1. Installation of low-version MinGW compilation, 2. Download and installation of module QSerialport

1. Install a lower version of MinGW or other components in QT6

Please refer to: https://blog.csdn.net/weixin_43794311/article/details/132483610?

Second, download the lower version of QSerialport you want to use

You can use the mirror source to quickly download the compressed package of QSerialport. Tsinghua mirror , download the lower version , you can choose other versions
1. Decompress the downloaded compressed file.
After decompression, it will contain some of the following files
Insert image description here

2. Use QT6 to open the downloaded low-version project
. There is a problem. Opening the low-version project file is incompatible . Only a .pro file is displayed in the project, so the installation of the module will also fail. The solution is as shown in the figure below, just choose the compiler suitable for the old version file. Then when you open the project, all the files will be displayed, not just a .pro file, but also the following installation will go smoothly.
The following pops up automatically when opening the old version of the QSerialport project, and the lower left corner shows that it is not configured. At this time, you can choose a lower version of the compiler.
Insert image description here
The following is the installation of the old version of QSerialport,
Insert image description here
Insert image description here
and then select make in the add build step, as shown below.
Insert image description here
The following is how to select the appropriate compiler build kit.

Insert image description here
If there is no problem with the following operations, you can import it.
Insert image description here

The import and actual results are not exactly the same

The first type : Although the QSerialport module can be imported, it is not imported directly. According to the prompt software prompts, the import method seems to be different.

Insert image description here
The second type : compiler selection. As long as you use QSerialport, you must use a lower version of the compiler, otherwise an error will be reported.
Insert image description here

Try to find a good way, you can't change the compiler version every time

See if you can find a QSerialport file that can be compiled with a higher version of the compiler.
So directly find the file of this module of this version
Insert image description here
Insert image description here
Insert image description here
Insert image description here
of qt . After testing and running, it is found that it can be used normally, so that a higher version of the compiler can be used. But if the file is an old version, it is likely that an old compiler will still be needed to pass it.

Guess you like

Origin blog.csdn.net/weixin_43794311/article/details/132483421