Ask Your Question
0

Can't find opencv.hpp, however it is not installed in /usr/include/

asked 2017-01-09 02:17:05 -0600

rektek gravatar image

updated 2017-01-10 01:53:19 -0600

Context: I am a new Ubuntu 16.04 user and I am trying to get OpenCV running on my system. I had some problems downloading and installing OpenCV with CUDA installed, so I used the solution as proposed by daveselinger in his last post here: https://github.com/opencv/opencv/issu....
This left me with OpenCV installed at: ~/Documents/my\ folder/opencv/. Notably, this also includes: ~/Documents/my\ folder/opencv/include/opencv2/opencv.hpp.
Now as far as I have been able to figure out, there should (also?) be a copy at: /usr/include/opencv2/opencv.hpp. At least, if I have interpreted the answer here correctly: http://www.answers.opencv.org/questio.... Now the issue is that there is no folder "openCV2" (nor a folder "openCV") in /usr/include/. This probably is the reason why #include <opencv2/opencv.hpp> leads to "fatal error: opencv2/opencv.hpp: No such file or directory". Does anyone know how to solve this error? Normally I would try several times of reinstalling, but installing openCV took around 4 hours, so I'd like to take a more structured approach if possible.

Edit: the solution was that I failed to use sudo make install in the installation of openCV. This caused the files to fail to be copied to /usr/local/include. That in turn made them impossible to find for programs trying to use those files.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-01-09 02:53:45 -0600

berak gravatar image

updated 2017-01-09 07:40:44 -0600

try: /usr/local/include instead.

(unless you changed it, CMAKE_INSTALL_PREFIX by default points to /usr/local on linux, also, ~/Documents/my/folder/opencv/ is the src dir, not the install one)

you might also try using cmake again, for your project

edit flag offensive delete link more

Comments

I tried /usr/local/include, but it wasn't there either. The larger issue is trying to install caffe. So in the makefile.config of caffe I tried adding to the "INCLUDE_DIRS": /home/myName/Documents/my\ folder/opencv/include. However this didn't work either,still it couldn't find it, although that folder does contain "opencv2/opencv.hpp". As an aside: in the mean time I discovered that I had CUDA turned off in the makefile. When I turned it back on it couldn't find "cudnn.h". This was solved by adding the relevant folder to INCLUDE_DIRS. The only difference I could find is that this file wasn't in a subfolder and that this path didn't contain a space. Could either be the cause of the problem?

rektek gravatar imagerektek ( 2017-01-09 08:04:38 -0600 )edit

again, the src/include folder contains "opencv2/opencv.hpp", but none of the other required module headers.

(also, you should not use backslashes (\) on linux)

then, unfortunately, we can't help you installing caffe, here ;(

berak gravatar imageberak ( 2017-01-09 08:18:10 -0600 )edit

I don't quite understand your comment. If src/include contains opencv2/opencv.hpp (and it does), why can't caffe find that specific file? And if also all files in the modules folder are necessary, how are the paths to those files usually added? And finally: I was trying to use the backslash to escape the space character, is that wrong?

rektek gravatar imagerektek ( 2017-01-09 09:14:47 -0600 )edit

make install copies all headers to whatever CMAKE_INSTALL_PREFIX points to (again, usually /usr/local/include).

you should not try to use any includes from the src folder at all.

berak gravatar imageberak ( 2017-01-09 09:20:11 -0600 )edit
1

Thank you! After double checking it appears I indeed either forgot to use make install in my final attempt at installing openCV, or missed that it failed due to lack of root access. Now it works!

rektek gravatar imagerektek ( 2017-01-10 01:51:21 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-09 02:17:05 -0600

Seen: 8,219 times

Last updated: Jan 10 '17