Ask Your Question
1

undefined reference while using EclipseCDT and opencv

asked 2015-04-26 23:26:40 -0600

merrittr gravatar image

I have some code :

enter code here #include <highgui.h> #include <iostream> #include <stdio.h> #include <cv.h>

    using namespace std;
    using namespace cv;
    using namespace std;

    int main()
    {
        cvNamedWindow("people detecting camera",1);
        CvCapture* capture = cvCaptureFromCAM(CV_CAP_ANY);
        CascadeClassifier peopleDetector;
        peopleDetector.load("src/people.xml");
        if(peopleDetector.empty())


and i get these errors

undefined reference to `cvNamedWindow'
undefined reference to `cvCreateCameraCapture'
undefined reference to `cv::CascadeClassifier::CascadeClassifier()'
undefined reference to `cv::CascadeClassifier::load(std::string const&)'
undefined reference to `cv::CascadeClassifier::empty() const'

Now from what I have all the imclude directories added does this mean the compiler cannot find the openCV library
edit retag flag offensive close merge delete

Comments

1

some hints:

  • please use the c++ api, not the c - one., #include <opencv2/opencv.hpp> not <cv.h>cv::VideoCapture , not CvCapture .
  • you need to link to opencv libs, like -lopencv_highgui -lopencv_objdetect
berak gravatar imageberak ( 2015-04-27 02:20:00 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-04-27 02:13:10 -0600

tomnjerry gravatar image

This is a typical linker error. Link all the libraries from openCV correctly to your project. Make sure you have the 'highgui' linked to your project as that seems to be the most probable reason for the problem you are facing. You can also look at this to make sure no other errors occur. Hope this helps.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-04-26 23:26:40 -0600

Seen: 838 times

Last updated: Apr 27 '15