Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include path for adding an external library in 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: http://i.stack.imgur.com/Pmsqq.png

Here is an image of the precompiled OpenCV files that I downloaded: http://i.stack.imgur.com/vNRNt.png

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.

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?

like image 401
user3103152 Avatar asked Dec 14 '13 21:12

user3103152


People also ask

Is Qt Creator an IDE?

Qt Creator is a cross-platform integrated development environment (IDE) built for the maximum developer experience. Qt Creator runs on Windows, Linux, and macOS desktop operating systems and allows developers to create software across desktop, mobile, and embedded platforms.

Does QT need Creator?

You certainly don't have to use QtCreator to write a Qt program. You also don't have to use qmake but you are asking for trouble by not using it. To do anything even remotely interesting in Qt you will inevitably end up subclassing QObject .


1 Answers

See the documentation for include path, and libs.

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\
}

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>

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

like image 54
Zlatomir Avatar answered Sep 26 '22 14:09

Zlatomir