包括在Qt Creator中添加外部库的路径? [英] Include path for adding an external library in Qt Creator?

查看:1344
本文介绍了包括在Qt Creator中添加外部库的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将预编译(MSVC2012)OpenCV静态库包含到Qt Creator中,但我不确定包含路径是关于如下图像:

I am trying to include the pre-compiled (MSVC2012) OpenCV static libraries into Qt Creator but I am unsure what the include path is about as per this image:

这里是预编译的OpenCV的图片我下载的文件:

Here is an image of the precompiled OpenCV files that I downloaded:

有3个目录:bin包含DLL,lib包含小的lib文件(2 kb),因此QtCreator可以理解DLL,而staticlib包含大型lib文件(1 mb)

There are 3 directories: bin contains DLLs, lib contains small lib files (2 kb) so that QtCreator can understand the DLLs, and staticlib containts large lib files (1 mb) which are the static libraries that I'm trying to link against.

库文件/路径是类似于 C:\opencv\build\ x86 \vc11\staticlib\opencv_features2d247d.lib ,对不对?有大约50个lib文件。

The library file/path is something like C:\opencv\build\x86\vc11\staticlib\opencv_features2d247d.lib, right? There are roughly 50 lib files. Do I have to each one manually?

推荐答案

请参阅包含路径 libs

另请注意,您需要链接到调试版本中的d结尾的文件以及其他版本中的文件(如果您使用x86和x64版本,应该使用正确的库),这里是一个测试.pro(我只使用x86和vc10)的示例:

Also note that you need to link with the files ending with 'd' in the debug build and the others in release (also if you use x86 and x64 builds, you should use the correct libraries), here is a sample from a test .pro (i only use x86 and vc10):

INCLUDEPATH += D:\\ProgrammingTools\\opencv\\build\\include

CONFIG( debug, debug|release ) {
LIBS += -LD:\\ProgrammingTools\\opencv\\build\\x86\\vc10\\lib\
    -lopencv_core246d\
    -lopencv_highgui246d\
    -lopencv_imgproc246d\
    -lopencv_features2d246d\
}
else {
LIBS += -LD:\\ProgrammingTools\\opencv\\build\\x86\\vc10\\lib\
    -lopencv_core246\
    -lopencv_highgui246\
    -lopencv_imgproc246\
    -lopencv_features2d246\
}

请注意,有-L__NO_SPACE_ PATHTOLIB和-l _NOSPACE__libname,你不需要添加所有的lib文件,你只需要添加你使用函数的那些文件,样本也包括这样的文件:

Notice that there is -L__NO_SPACE_PATHTOLIB and -l_NOSPACE__libname, you don't need to add all the lib files, you only add the ones that you use functions from, and also the samples include files like this:

#include <opencv2/opencv.hpp>

因此include-path在包含两个文件夹(而不是实际的头文件)的文件夹中结束

so the include-path ends in a folder that contains two folders (not the actual header files)

这篇关于包括在Qt Creator中添加外部库的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆