简体   繁体   English

Qt:包括.pri使用库-不正确的包括

[英]Qt: Include .pri to use library - incorrect includes

I'm trying to use QtSerialPort ( http://qt-project.org/wiki/QtSerialPort ) with Qt 4.8. 我正在尝试将QtSerialPort( http://qt-project.org/wiki/QtSerialPort )与Qt 4.8一起使用。 It's not part of that version, so I have to install it manually. 它不是该版本的一部分,因此我必须手动安装它。 To avoid to manually install it, I just wanted to include the .pri file that is shipped with QtSerialPort. 为了避免手动安装,我只想包括QtSerialPort随附的.pri文件。 I got my copy by doing "git clone https://git.gitorious.org/qt/qtserialport.git ". 我通过执行“ git clone https://git.gitorious.org/qt/qtserialport.git ”获得了副本。 Using it in my *.pro file with: 在我的* .pro文件中使用它:

include(qtserialport/src/serialport/serialport-lib.pri)

But compiling fails bc. 但是编译失败。 of includes like: 包括:

#include <QtSerialPort/qserialportglobal.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? 因此,我猜想这些include可以解析为/ usr / include之类的东西。有什么方法可以解决此问题,而无需手动将所有include都更改为“ 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? 因此,我猜想这些include可以解析为/ usr / include之类的东西。有什么方法可以解决此问题,而无需手动将所有include都更改为“ foo.h”?

Yes, sure. 是的,当然。

First, you would need to write CONFIG += serialport as per documentation. 首先,您需要根据文档编写CONFIG += serialport

You could also specify the includepath to the qtserialport clone on your system. 您还可以在系统上指定qtserialport克隆的includepath。

You would still need to get the library built, but I assume that you are aware of it. 您仍然需要构建库,但是我想您已经知道了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM