我正在尝试将 QtSerialPort ( http://qt-project.org/wiki/QtSerialPort ) 与 Qt 4.8 一起使用。它不是那个版本的一部分,所以我必须手动安装它。 为了避免手动安装它,我只想包含 QtSerialPort 附带的 .pri 文件。 我通过执行“git clone https://git.gitorious.org/qt/qtserialport.git”得到了我的拷贝。 在我的 *.pro 文件中使用它:
include(qtserialport/src/serialport/serialport-lib.pri)
但是 bc 编译失败。其中包括:
#include <QtSerialPort/qserialportglobal.h>
所以我猜这些包括解析为类似/usr/include 等的内容。有没有办法解决这个问题而无需手动将所有包含从“foo.h”更改为“foo.h”?
最佳答案
So I guess these includes resolve to something like /usr/include etc. Is there any way to fix this without changing all the includes from to "foo.h" manually?
是的,当然。
首先,您需要根据文档编写CONFIG += serialport
。
您还可以指定系统上 qtserialport 克隆的包含路径。
您仍然需要构建库,但我假设您已经意识到这一点。
关于c++ - Qt:包含 .pri 以使用库 - 不正确的包含,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22299991/