user3693423
user3693423

Reputation:

Symbol 'cv' could not be resolved in eclipse

I am trying to config openCV in eclipse, in include path i have added

/usr/local/include/opencv
/usr/local/include

and i have used pkg-config --libs opencv to add some library in GCC C++ Linker:

/usr/local/lib/libopencv_calib3d.so
/usr/local/lib/libopencv_contrib.so
...

in header file i included:

#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/eigen.hpp>

but when i declare

using namespace cv;

i get an error: Symbol 'cv' could not be resolved

Upvotes: 6

Views: 7978

Answers (3)

Marco Ruiz
Marco Ruiz

Reputation: 41

You should include at first place /usr/local/include in GCC C++ Compiler. See the next picture.

enter image description here

Upvotes: 3

You should include opencv.hpp
go to GCC C++ Compiler, go to Includes. In Include File(-l) add /usr/include/opencv2/opencv.hpp

Upvotes: 0

Filip Ros&#233;en
Filip Ros&#233;en

Reputation: 63797

The problem is that the linker cannot find a symbol named cv.

Assuming that you have installed everything correctly, ie. that every file [1] is where it's supposed to be, it's because you haven't told the linker what files it should link against.

Note: Are the files listed by pkg-config --libs opencv actually there?


SOLUTION

  1. Go to your project's properties
  2. click C/C++ Build
  3. click Settings
  4. find GCC C++ Linker (under the Tool Settings tab)
    1. press Libraries
    2. Add the OpenCV libraries.

DETAILED GUIDE

OpenCV has an official guide on how to make it work with Eclipse:

Upvotes: 7

Related Questions