Qt6 installs the serial port module QSerialPort

1 Introduction

QtIt seems that the serial port library and the content in the previously used header files will not be included in 5.2the version and later versions QSerialPort, but if you want to use this software library when Qtdeveloping , you need to find another way. Before trying to recompile in this article version of QSerialPortthe library and install it into the new version of Qt Creator.

QtThe versions currently used by the author are 6.3.1and 6.2.4.

2. Download QSerialPort source code

It is recommended to download from Tsinghua University Open Source Software Mirror Station .

Select a directory qt> official_releases> qt> 5.15> 5.15.6> submodulesclick qtserialport-everywhere-opensource-src-5.15.6.zipDownload .
Here the author chooses the 5.15.6version of QSerialPortthe source code.
The author chooses: qtserialport-everywhere-opensource-src-5.15.6.zip

After the download is successful, unzip it, and you will see the following source code list.
insert image description here

3. Build and install the QSerialPort project

  • Use to Qt Creatoropen the decompressed project, as shown in the figure below;

insert image description here

  • Click on the item;

insert image description here

  • In Buildstep add Make;

insert image description here

  • Make argumentsfill ininstall

insert image description here

  • Select the version and compilation method to be installed Debugor Release;

insert image description here

  • Click Build and wait for a while. If there is no error, the installation is successful. You can choose according to your needs in the previous step. If you are not sure, choose each one, and then select Debugand Releaseversion at the same time and execute it again.

4. Verification

Use the QSerialPortlibrary ;
insert image description here
select the compiler that was added before to compile;
insert image description here
it can run successfully.
insert image description here

Installed

Guess you like

Origin blog.csdn.net/qq_36393978/article/details/127861862