Ask Your Question

I did the opencv installation instruction completely (in obunto 16, opencv 3.1.0(and 3.2)), but when i run a program, it encounter with problem

asked 2017-03-20 01:57:54 -0500

ashkan gravatar image

i wrote the code, and i wrote the CMakeLists.txt as it said in the site, then i wrote cmake . in linux terminal and everything went ok, but, when i wrote make, the following error has been appeared:

Scanning dependencies of target DisplayImage [ 50%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o /home/ashkan/Desktop/DisplayImage.cpp:1:30: fatal error: opencv2\opencv.hpp: No such file or directory compilation terminated. CMakeFiles/DisplayImage.dir/build.make:62: recipe for target 'CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o' failed make[2]: * [CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o] Error 1 CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/DisplayImage.dir/all' failed make[1]: [CMakeFiles/DisplayImage.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: ** [all] Error 2

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2017-03-20 12:03:59 -0500

cpagravel gravatar image

updated 2017-03-20 12:04:43 -0500

The issue is that the compiler cannot find "opencv.hpp". Since you're working on the Linux kernel, you need to use forward slashes for directories "/" instead of "\".

You have "opencv2\opencv.hpp" written instead of "opencv2/opencv.hpp". If you copied the code from somewhere, they were probably working on a Windows machine.

edit flag offensive delete link more


Can the downvoter please leave a comment? This is the correct answer. You need to use forward slashes for directory paths in Linux.

cpagravel gravatar imagecpagravel ( 2017-03-20 12:07:01 -0500 )edit

@cpagravel, apologies, that was me, a simple misfired click. please ignore.

(and indeed, this is the correct answer)

berak gravatar imageberak ( 2017-03-21 02:03:15 -0500 )edit

that was exactly correct, I appreciate you

ashkan gravatar imageashkan ( 2017-03-21 05:29:09 -0500 )edit

@berak No worries. @ashkan Glad to help.

cpagravel gravatar imagecpagravel ( 2017-03-21 13:07:12 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2017-03-20 01:57:54 -0500

Seen: 129 times

Last updated: Mar 20 '17