Ask Your Question
0

Linux CMake installation - hpp include files are sparsed in different directories

asked 2020-03-04 18:26:53 -0600

BSaraiva gravatar image

System is Ubuntu 19.10, library compiled via CMake 3.13.4. OpenCV version is 4.2.0. Trying to create projects in C++, using VSCode.

I have repeated the installation instructions some six times, including compiling the full library with CMake. And can't still figure out what is wrong:

I would assume that the only #include needed is #include <opencv2 opencv.hpp="">

This file "ended up" being at /home/myusername/projects/opencv420/include/opencv2. My project's includePath directory is hence: /home/myusername/projects/opencv420/include

However, opencv.hpp it is the only .hpp in that folder. Hence, the intellisense immediately flags an error saying it has not found opencv2/opencv_modules.hpp - which is in a separate folder. That would be "solved" by adding another directory to the includePath: /home/nomadlog-laser/projects/opencv420/build

Doing that, intelliSense immediately flags the lack of opencv2/core.hpp. Once again I can force a solution and add one more directory to includePath - only to miss now calib3d.hpp... And so on...

What am I doing wrong, that I can't get all the .hpp files in the same folder?

Bruno

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2020-03-05 02:02:29 -0600

berak gravatar image

you should not try to include headers from the opencv src folder.

make install should have copied them to whatever CMAKE_INSTALL_PREFIX points to, usually /usr/local on linux.

for opencv 4, add /usr/local/include/opencv4 to your include path

edit flag offensive delete link more

Comments

1

Hello berak, thank you very much for your input!

Your answer perfectly solves the question. I had figured it out some time after posting, but I thought I'd leave the post for future reference.

I was misguided by the instructions related to CMAKE_BUILD_TYPE, and their suggestion of using the value as Release-D CMAKE_INSTALL_PREFIX=/home/myusername/projects/opencv420 ..

It is clearly my first venture into the world of CMake (I've used the GUI for the above task, by the way). Could you care to elaborate a bit about that that parameter actually does?

Now I'm dealing with the next challenge, which is to get rid of the compile error: make[2]: No rule to make target 'opencv_calib3d-NOTFOUND', needed by 'MyProject'. Stop.

Will make a detailed post if I get nowhere.

Cheers!

BSaraiva gravatar imageBSaraiva ( 2020-03-05 03:25:42 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-03-04 18:26:53 -0600

Seen: 1,045 times

Last updated: Mar 05 '20