Ask Your Question
0

VS 2015 says it cant find opencv2\opencv.hpp

asked 2016-02-27 15:02:20 -0600

feraudyh gravatar image

Hello, I just uncompressed openCV3.1 and put the source and build directory to this directory:

d:\openCV\openCV3.1\

so

d:\openCV\openCV3.1\build\include\opencv2\opencv.hpp

really exists.

Inside my VS 2015 community edition I created a test project whose first line is

#include <opencv2/opencv.hpp>

My project was a console project which was marked as "empty". In the properties page of the project I have set as additional Include directories the following

D:\openCV\OpenCV3.1\build\include;%(AdditionalIncludeDirectories)

but the error persists: the compiler claims that it cannot open the source file opencv2/opencv.hpp It does not help if I replace the slash by a backslash.

I had exactly the same problem with VS 2013 community edition, and posted a question on stackoverflow, but the people who wanted to help were stuck. At the time I found the workaround of copying the whole lot of include files to my source directory. This is not really elegant.

If I right click on the #include "opencv2/opencv.hpp" I get the following message image description Any comments?

edit retag flag offensive close merge delete

Comments

for a while I thought I had inverted opencv2 and opencv, but no. Hardwiring the include path is another workaround at first sight, but then using namespace cv causes an error!

feraudyh gravatar imageferaudyh ( 2016-02-27 14:47:35 -0600 )edit

well, you say, that you appended opencv/build/include to your additional includes, but the messagebox above proves you wrong.

berak gravatar imageberak ( 2016-02-27 23:32:14 -0600 )edit

That's all very well, but I could post up a screen shot showing my entry for "Additional Include Directories"

feraudyh gravatar imageferaudyh ( 2016-02-27 23:42:01 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2016-02-27 23:49:22 -0600

feraudyh gravatar image

It turned out the inconsistency of the Debug vs Release builds. When I modified one build, the other build was being compiled. VS does this without warning.

edit flag offensive delete link more

Comments

yes, you have to manually change both property sheets, it's not copied magically from one to another.

berak gravatar imageberak ( 2016-02-28 00:00:34 -0600 )edit

This is what happens when you do most of your development with another IDE (QtCreator in my case). In QtCreator you have to go out of your way to set different INCLUDEPATH's for Debug and Release environments.

feraudyh gravatar imageferaudyh ( 2016-02-28 04:25:49 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2016-02-27 14:43:53 -0600

Seen: 4,315 times

Last updated: Feb 27 '16