Where are the correct include directories for OpenCV projects using a local build / self-build of OpenCV?
I'm trying to debug a frustrating problem whereby I cannot load video files in OpenCV. One suggestion is to abandon the OpenCV pre-built libraries and instead build OpenCV on the same machine as the failing project.
That is what I am now trying to do.
In the OpenCV Quick Start about how to build applications with OpenCV inside the Microsoft Visual Studio one important step is to add the additional include directories to the project property sheet by opening the project's property pages, navigating to Configuration Properties -> C/C++ -> General -> Additional Include Directories
. Using the pre-built distribution I am advised to add the directory C:\OpenCV2.4.6\build\include
and indeed inside that directory are sub-directories opencv
and opencv2
. One of the files my project (like most OpenCV projects) will need is highgui.hpp
from the line
#include "opencv2/highgui/highgui.hpp"
In the pre-built OpenCV distribution highgui.hpp
ends up in C:\OpenCV2.4.6\build\include\opencv2\highgui
and is thus correctly picked up at compile time because of the additional include directory.
Having generated with CMake and built with Visual Studio 2012 the latest version of OpenCV on my machine (though perhaps unsuccessfully) I cannot find highgui.hpp
. It is not in C:\Users\timregan\Documents\GitHub\opencv\build\include
(in fact there are no sub-directories opencv
nor opencv2
in there). It is in C:\opencv-2.4\modules\highgui\include\opencv2\highgui
.
What step, flag, etc. did I omit in order to generate place it correctly on my machine? Why are the opencv
and opencv2
sub-directories missing completely from C:\Users\timregan\Documents\GitHub\opencv\build\include
after I have generated and built OpenCV?
(N.B. I'm using CMake 2.8.12 and Visual Studio 2012 on a Windows 8 machine.)
Thanks @berak, that works. If you copy that advice into an answer I'll mark it as such.
Hi, i'm facing the same issue, however i'm on a mac, and there is no INSTALL project that gets generated in my opencv folder. What alternate steps should i follow on the mac? Or should i also have had the INSTALL project to compile if things had gone correctly? (i just ran make and make)
@sachi - isn't it just
make install
then ?According to me
make install
will create symlinks of my headers and libs into usr/local and usr/include (right?), but i don't want opencv to be installed globally on my system, just the folder structure to be the same as it would have been had i installed it via brew into usr/local/Cellar, i.e., with the opencv/include/opencv2 folder containing the HPPs of all the other modules. Right now i just have opencv.hpp(within the opencv2 folder) and a couple of cmake and make files in my include folder .you can specify the install path with cmake (CMAKE_INSTALL_PREFIX), and sure, you can redirect that to your home folder or such
Okay solved, thanks!
Hi, setting the install path to a non standard location gives an error in Xcode when i link the .dylibs in my project. In my case the error is:
dyld: Library not loaded: lib/libopencv_calib3d.3.1.dylib Reason: Image not found
. I have given the relevant search paths w.r.t where the libraries are placed. Should i change the value of INSTALL_NAME_DIR from lib to ${CMAKE_INSTALL_PREFIX}/lib?@sachi, can't help. and since this was a win-related question, - rather start your own, now ?
Yep,shall do that, thanks.