C++ – #include not working in VS 2013

copencv

I have VS2013 community edition, I just installed OpenCV in a directory c:\openCV3 and there is a build subfolder with an include subfolder of that etc, everything looks normal. So I create an empty project with the line#include <opencv2/opencv.hpp> but I get

Error 1 error C1083: Cannot open include file: 'opencv2/opencv.hpp': No such file or directory d:\devt\cplusplus\opencv\test1\test1\source.cpp 1 1 Test1

However I have modified my project's additional include directories to this:

C:\OpenCV3\build\include\opencv;C:\OpenCV3\build\include\opencv2;C:\OpenCV3\build\include;%(AdditionalIncludeDirectories)

But nothing doing, the mistake does not go away. Pretty much the same question has been asked before but the answers do not work for me.

Update:
I right clicked on <opencv2/opencv.hpp> and, in the popup menu chose OpenDocument.
I got the following message box:
File Not Found

What I found surprising is that there is no mention of my set of additional include directories.

Best Answer

Instead of use the includes C:\OpenCV3\build\include\opencv and C:\OpenCV3\build\include\opencv2, try to use C:\OpenCV3\build\include\. When you call an include you're already telling the folder you are using:

#include <opencv2/opencv.hpp>

In that case, VS is searching opencv2/opencv.hpp in folder opencv2... VS must search in the folder include, so it will found opencv2/opencv.hpp...

(or you can try to modify your include to "#include "

Hope it helps.