How to link and use OpenCV headers?

That's right, I know this is a very stupid question, but I have no luck with the w / e I'm trying to do.

I'm trying to use the objdetect.hpp header file, so I included the folder C: \ OpenCV2.1 \ include \ opencv2 \ as well as C: \ OpenCV2.1 \ include \ opencv and a whole group of other DLLs and libraries when I followed the instructions http://opencv.willowgarage.com/wiki/VisualC%2B%2B_VS2010

But the openCV version in this tutorial is deprecated and doesn't even have an objdetect.hpp file. So I went to download the latest version (OpenCV 2.4.0), but now when I follow it, it gives me error C1083: Unable to open include file: "opencv2 / core / core.hpp" There is no such file directory.

Is it possible to place all OpenCV folders / files in the same directory as my C ++ project? Or how can I fix this? I tried putting it in the same place as my C ++ project, but when I do #include "../" , the folder does not appear.

Again, I know this is a stupid question, but please help.

Let me know if anyone needs more information. I'm not sure what to do.

thanks

+1
source share
1 answer

The best way to manage changing directories for include files is with compiler options. I better use linux and g ++, where you simply specify different path locations with -I attributes.

It is generally considered bad practice to use relative and absolute paths in #include statements. The module paths are in the order #include <sys/time.h> , where sys can be considered a module. Include the file only with its name and, possibly, with the module, then process the location using the compiler options.

+1
source

All Articles