This question was asked several times, there are some answers, but this problem is more specific, the additional directories path is set correctly (files are found).
Nevertheless building my project i get the following error:
fatal error C1083: Cannot open include file:
'opencv2/opencv.hpp': No such file or directory
but i can right click on the file and open it in visual studio 2012?
I tried:
1) specifying the full path: WORKS!
#include <D:\frameworks\opencv_2_4\build\include\opencv2\opencv.hpp>
2) Putting the file to C:\ Doesn't Work! (add. directories added)
3) Empty project with the same include syntax. (add. directories added). WORKS!
4) I've configured a VS2010 Version of the same project with CMake, and i have there the same problems.
Any hints what could be causing this error?
If you put the headers within your project. As @CalaveraLoco's answer. Could using the relative path to access the header.
But it's better to include the project folder path into your project settings.
Properties
of the project.C/C++
General
$(ProjectDir);
into Addition Include Directories
project property => C/C++ => General => Additional include Directories => "put the address of library from your openCV folder eg: C:\opencv\build\include As shown in the picture below
Open Configuration Properties > C/C+ + > General , and edit the field Additional Include Directories to add these 3 paths (for the headers): C:\OpenCV2.3\build\include\opencv C:\OpenCV2.3\build\include \opencv2 C:\OpenCV2.3\build\include
In my case the problem had to do with exported classes.
I have 2 VS projects. Let's name them A and B. Project A uses classes from project B; and project B uses classes of OpenCV. Project A didn't use (neither link) OpenCV. (as you can imagine project A uses openCV throught project B).
But if any of the exported classes of B (used by A) had a private member of type OpenCV (cv::Mat, for example), in that case, the error C1083 appeared, although i had correctly linked openCV in project B.
My solution was to be carefull with the includes in the *.hpp files of the exported classes of project B.
Hope it's usefull.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With