OpenCV using Eclipse with CDT

I have always used QtCreator for OpenCV, but a new project started with a friend should be done using eclipse.

I did everything that I usually do with QtCreator, but I had a strange problem. Although I set the include path (/ home / opencv / include) when I try to compile, I get errors for missing headers (like opencv2 / core / core.hpp). In the project explorer, under the include tag, only headers that are on the first level of the included directory are displayed. This means cdt does not include recursive headers.

Is this a mistake, or do I need to include every single directory?

enter image description here

+4
source share
3 answers

I also had this problem. I think you need to include the path opencv / build / include, not opencv / include. This is where all the header files are.

+3
source

I had the same problem yesterday. He searched all the forums, but no one could answer me. Finally, I realized that I am making an inclusion for the entire project and including the files for the project does not match how , including the files for the source of the source file. cpp " (for eclipse, because for VisualStudio it's the same).

enter image description here

So, try right-clicking in the .cpp file and include directories in it. In any case, if you tell me which version of OpenCV you are using, I can tell you more about how to include files in case you have problems.

Hope this helps. When you get errors about missing headers, they are always related to inclusion. At least it happened in my case.

+5
source

If the inclusion path in Eclipse is /home/opencv/include , we assume that there are 2 folders inside this directory: opencv and opencv2 .

In the source code, you should reference the headers as:

 #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> 

Does that make sense to you?

However, there are a few tutorials that can help you configure Eclipse .

+4
source

Source: https://habr.com/ru/post/1387558/


All Articles