Ask Your Question

donotspamme's profile - activity

2016-06-08 13:08:05 -0600 received badge  Notable Question (source)
2015-01-29 02:47:13 -0600 received badge  Student (source)
2015-01-29 02:47:10 -0600 received badge  Popular Question (source)
2012-11-30 08:11:11 -0600 commented question having trouble compiling one of the OpenCV tutorial examples

Well, I think I have an answer, but I can't post it as such until tomorrow, because "new members have to wait two days before answering their own question.
Well, here's the answer thus far:
Doh! Works if I do #include <opencv2 opencv.hpp="">, since the system location for include files (/usr/include on my system) contains the 'opencv2' directory of opencv include files.
Maybe a small edit to the tutorial would help other newbies?

2012-11-29 09:41:26 -0600 received badge  Editor (source)
2012-11-29 09:39:12 -0600 asked a question having trouble compiling one of the OpenCV tutorial examples

Platform: Fedora 17 x86_64 with OpenCV packages installed via yum

What I want to do:
Build a simple OpenCV program to get started learning OpenCV.
I'm trying the 'DisplayImage' program from the OpenCV tutorial 'Using OpenCV with gcc and CMake' which I found at http://docs.opencv.org/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html#linux-gcc-usage

I have tried following the instructions (I believe) word-for-word. I am new to cmake and don't understand everything it's doing, but when I run it, it appears to work, and a Makefile is produced.

However, when I run make with the generated Makefile, I get:

[tim@vos di]$ make
Scanning dependencies of target DisplayImage
[100%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.o
/home/tim/cp3/proj/di/DisplayImage.cpp:5:16: fatal error: cv.h: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/DisplayImage.dir/DisplayImage.o] Error 1
make[1]: *** [CMakeFiles/DisplayImage.dir/all] Error 2
make: *** [all] Error 2

The supplied example CMakeLists.txt file is:

project( DisplayImage )
find_package( OpenCV REQUIRED )
add_executable( DisplayImage DisplayImage )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )

Does '${OpenCV_LIBS}' refer to an environment variable that I should have set before running cmake? Or do I set it somewhere else? Or does cmake set it itself? If I need to set it explicitly, what do I set it to?

I tried "export OpenCV_LIBS=/usr/lib64" because I saw some opencv_*.so library files there. This did not fix my problem.

Looking at the error messages, it seems that cv.h is not being found (for #include <cv.h>). If I was compiling directly with g++ I would try adding "-I /usr/include/opencv" or similar to the compile command.

How essential is it that I use cmake as suggested in the tutorial?

Suggestions welcome.

Thanks, Tim