问:如何在.pro文件中包含多个不同类型的路径和库

时间:2018-02-08 15:32:03

标签: qt

我想在Qt .pro文件中包含多个路径。例如,文件中包含三个opencv路径:

C:/opencv-3.2.0/mybuild/include
C:/opencv-3.2.0/mybuild/include/opencv
C:/opencv-3.2.0/mybuild/include/opencv2

我尝试过(请参阅:INCLUDEPATH):

INCLUDEPATH = "C:/opencv-3.2.0/mybuild/include" "C:/opencv-3.2.0/mybuild/include/opencv" "C:/opencv-3.2.0/mybuild/include/opencv2"

这会将三条路径引用并用一个空格分隔,这在Qt中似乎有效,但对于单行来说太长了。还有其他更简单的格式吗?

除了路径包含之外,我还需要包含不同类型的库,一些用于opencv,另一些用于1394camera。我现在正在做的是:

CONFIG(release, debug|release): LIBS += -L"C:/Program Files (x86)/CMU/1394Camera/lib64/x64" -l1394camera -luser32 -L"C:/opencv-3.2.0/mybuild/x64/vc14/lib" -lopencv_core320 -lopencv_imgproc320 -lopencv_highgui320 

这也将所有库放在一行中。

1 个答案:

答案 0 :(得分:2)

INCLUDEPATH += C:/opencv-3.2.0/mybuild/include
INCLUDEPATH += C:/opencv-3.2.0/mybuild/include/opencv
INCLUDEPATH += C:/opencv-3.2.0/mybuild/include/opencv2

INCLUDEPATH += C:/opencv-3.2.0/mybuild/include \
               C:/opencv-3.2.0/mybuild/include/opencv \
               C:/opencv-3.2.0/mybuild/include/opencv2

请不要+=运营商保留已设置的路径。