-3

I have a problem : error LNK2019: unresolved external symbol [...] referenced in function main

 #include <opencv2/highgui/highgui.hpp>

using namespace std;
using namespace cv;

int main(int argc, char * const argv[])
{
    cvNamedWindow("P2", CV_WINDOW_AUTOSIZE); 
    //path to image ex : c:/Users/image.jpg
    CvCapture* capture = cvCreateFileCapture("path to image"); 
    IplImage* frame;

    while (1) { 
        frame = cvQueryFrame(capture);
        if (!frame) break; cvShowImage("P2", frame); char c = cvWaitKey(0); if (c == 27) break;
    } 
    cvReleaseCapture(&capture); cvDestroyWindow("P2"); 

    return 0;
}

enter image description here

I start my project by following tutorial, the same configuration to use OpenCV with visual Studio and Eclipse but I have the same error.

melidara
  • 1
  • 1
  • 2
    Did you link with the opencv libraries? BTW, what's the reason for using the ancient C API? – Dan Mašek Apr 05 '16 at 20:07
  • Can't copy and paste text from your image, sorry. – n. m. could be an AI Apr 05 '16 at 20:09
  • 1
    Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Miki Apr 06 '16 at 09:15

1 Answers1

0

Probably you're missing to specify input library (project property/link/input). You don't specify which version of opencv you are using. If you are using openCV 3.1 like me the lib is opencv_world310d.lib for debug and opencv_world310.lib for release. Please check also the bitness of your application. The prebuilt libraries are for 64 bit.

alangab
  • 849
  • 5
  • 20