1
votes

I want to configure eclipse-cdt for opencv in ubuntu. I followed the tutorial Using OpenCV with Eclipse (plugin CDT). However, I was ended up with error message

fatal error: cv.h: No such file or directory DisplayImage.cpp /opencvtest line 1 C/C++ Problem

I checked my configurations as indicated in the tutorial. Everything was fine except the information in 8.b.

As tutorial says for pkg-config --libs opencv, the output should be,

-L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann

But in my case the output was,

/usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_softcascade.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_ts.so /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so

Can anyone help me to fix this problem.

Thank you in advance.

2
Your error message says that compiler can't find cv.h header. So your eclipse project's path configuration is not configured to see opencv headers. Please show output of pkg-config --cflags opencv. Make sure that your paths contain that folders.Alexander Gorban
@Gorban pkg-config --cflags opencv o/p is "-I/usr/local/include/opencv -I/usr/local/include"chatcja
Check that some of those paths contains cv.h. If it contains - configure "Path and Symbols" section of project's properties.Alexander Gorban

2 Answers

4
votes

Try to change your header from:

#include <cv.h>
#include <highgui.h>

to:

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
0
votes

Thank you for all the answers. But the gain for the problem is bit strange. Here is it.

I am using ubuntu 12.1. I installed opencv using "git" as in the doc. Installation was completed without errors, but i received the above mentioned error.

Since any of the answers (@Alexander and @ Ann) didn't make any effect, I re-installed opencv using the downloaded file from "sourceforge". Then it worked perfectly. I think the problem was with the file I downloaded through git.

Anybody has any reason for this issue ?