vs2013 + QT组件开发串口程序

来源:互联网 发布:安卓的内存优化 编辑:程序博客网 时间:2024/06/06 02:44
VS2013 + QT组件添加QT串口模块

   在用VS + QT 开发串口类应用时,为了跨平台的需要,可以不用Windows的串口模块,而用QT自带的封装好的串口模块。

   使用QT串口模块需要添加QT的串口链接库Qt5SerialPortd.lib文件(Debug配置) Qt5SerialPort.lib(Release配置)
   配置步骤如下:
   1. 添加QT环境变量QTDIR  路径:D:\Qt\Qt5.9.0\5.9\msvc2013_64(根据自己QT库安装位置配置)
   
   2. 分别在Debug和Release模式下配置串口库路径如下步骤:

      (1)Project Properties -> Configuration Properties -> C/C++ -> General -> Additional Include Directories, added line: $(QTDIR)\include\QtSerialPort
      (2)Project Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, added line: QT_SERIALPORT_LIB
      (3)Project Properties -> Configuration Properties -> Linker -> Input-> Additional Dependencies, added line: Qt5SerialPort.lib