1 Introduction
Qt
It seems that the serial port library and the content in the previously used header files will not be included in 5.2
the version and later versions QSerialPort
, but if you want to use this software library when Qt
developing , you need to find another way. Before trying to recompile in this article version of QSerialPort
the library and install it into the new version of Qt Creator
.
Qt
The versions currently used by the author are 6.3.1
and 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
> submodules
click qtserialport-everywhere-opensource-src-5.15.6.zip
Download .
Here the author chooses the 5.15.6
version of QSerialPort
the 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.
3. Build and install the QSerialPort project
- Use to
Qt Creator
open the decompressed project, as shown in the figure below;
- Click on the item;
- In
Build
step addMake
;
Make arguments
fill ininstall
- Select the version and compilation method to be installed
Debug
orRelease
;
- 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
Debug
andRelease
version at the same time and execute it again.
4. Verification
Use the QSerialPort
library ;
select the compiler that was added before to compile;
it can run successfully.