Ask Your Question

Location of the headers moved?

asked 2013-04-26 12:40:43 -0500

Elador gravatar image

updated 2013-04-28 06:46:45 -0500


a few weeks ago, I pulled opencv from git and compiled using cmake & vs2012. On my laptop, after compiling and running the INSTALL target, I get a structure like

`C:\opencv\install\include\opencv2\<moduleName>\someHeader.hpp`, e.g.

In my code, I could then just #include "opencv2/core/core.hpp" and it was working perfectly in windows, linux, with people who used the downloadable-precompiled opencv - so all the paths seem to be right.

When pulling opencv from git today on another computer, also with cmake and vs2012, after compiling and INSTALL'ing, I get one folder


and all the headers are just in there. There are no module subfolders. All headers are just in the "root". There is still a opencv2 subfolder there but it contains only 2 files. Of course, now my project fails compiling, as it can't find the includes under #include "opencv2/core/core.hpp".

I compiled opencv so many times, always used the same steps and never had this problem. What could possible be gone wrong on this computer?


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-26 13:07:44 -0500

berak gravatar image

updated 2013-04-28 06:02:17 -0500

yes, changes going on there. (errors being made probably, too.)

it seems the module headers ( as in api/client ) are moved one up, so it's




2 weeks ago, the cmake-generated install script would still (correctly) copy the headers in this way, but it seems broken now ( fetched 3 days ago )

my current workaround for my own projects depending on opencv is:

  1. regenerate proj/solution file using cmake this will add the includes of the modules, not the ones from install/build

  2. don't use opencv.hpp, but the explicit module headers instead, opencv2/core.hpp, opencv2/highgui.hpp, etc

edit flag offensive delete link more


Okay, thanks! That probably means for me I'll check out 2.4.5 and use that.

What do you mean with your suggestion "1."? I don't understand at all what you mean.

Concerning "2.", I never did that anyway! I always included the module headers, but as written above, their location has changed too.

I did not get any errors while compiling, what do you mean with am I "still" getting errors - maybe you confuse me with someone else?

Elador gravatar imageElador ( 2013-04-26 13:27:46 -0500 )edit

hmm, yea. using 2.4.5 in times, where the "bleeding edge" master is unstable makes total sense

there was some issue about limits header not included in features2d and some other modules. did not mean you specially, sorry for the confusion. good if that vanished

if you generate the vcproj. file for your own project with cmake ( same way as you did for the opencv libraries ), it will add the include path from, say opencv/modules/core/include instead of install/opencv2/core

berak gravatar imageberak ( 2013-04-26 13:39:15 -0500 )edit

Yea I generate my .sln also with cmake, but I always point the cmake of my own project to the opencv install dir, not the build-dir, as that's the proper way. But now I understand what you mean - I'll try that if 2.4.5 doesn't satisfy me for some reason, thank you :-)

Elador gravatar imageElador ( 2013-04-26 13:45:15 -0500 )edit

you're right, it points to the opencv-library dir, not to the install one. but at least that works ;)

berak gravatar imageberak ( 2013-04-26 13:49:45 -0500 )edit

Hi, I made a pull today after long time and after compiling and installing i did notice this change and it is really annoying cause my project is pretty big and with a lot of include to correct. By any chances do you guys know if it is gonna be a "stable" change and if they gonna fix the include directory when installing, so we can have the "compatibility" headers (opencv2\<moduleName>\someHeader.hpp) in the include dir? Otherwise i agree that the workaround @berak proposed is smart and it can save some work (for now...)

Simone gravatar imageSimone ( 2013-04-30 17:49:13 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2013-04-26 12:40:43 -0500

Seen: 550 times

Last updated: Apr 28 '13