As for any other 3rd party library, you have to add include path to your .pro file:
// project.pro
INCLUDEPATH += C:/OpenCV/cv/include \
C:/OpenCV/cvaux/include \
// ... other components if needed
// project.pro
INCLUDEPATH += C:/OpenCV/cv/include \
C:/OpenCV/cvaux/include \
// ... other components if needed
To copy to clipboard, switch view to plain text mode
and library path for linker (this is for dynamic linking):
// project.pro
LIBS += -LC:/OpenCV/bin //!< path to .dll files
LIBS += -lcv100 -lcvaux100 // here cv100.dll and cvaux.dll are linked, add other libs if needed
// project.pro
LIBS += -LC:/OpenCV/bin //!< path to .dll files
LIBS += -lcv100 -lcvaux100 // here cv100.dll and cvaux.dll are linked, add other libs if needed
To copy to clipboard, switch view to plain text mode
Last thing to do is to configure the QtCreator indexer, to be able to use code completion with symbols from OpenCV library.
I don't know if there is a way to "click" it, I've just updated the "project.includes" file (its a txt file, so you can just paste the include paths there):
// project.includes
//...
C:\OpenCV\cv\include
C:\OpenCV\cxcore\include
// other path for indexer
// ...
// project.includes
//...
C:\OpenCV\cv\include
C:\OpenCV\cxcore\include
// other path for indexer
// ...
To copy to clipboard, switch view to plain text mode
Now OpenCV is ready to use with your project.
All above was for OpenCV 1.0 and Windows platform, but the principle is the same for any OS and library version ( new OpenCV is separated into modules, so there will be more to include / link ).
Bookmarks