我想在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
这也将所有库放在一行中。
答案 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
请不要+=
运营商保留已设置的路径。