0

Error 2 error LNK1120: 1 unresolved externals
Error 1 error LNK2019: unresolved external symbol "bool __cdecl identical(class cv::Mat,class cv::Mat)" (?identical@@YA_NVMat@cv@@0@Z) referenced in function _main

this is the error i am getting...tried a lot but still couldnt corrrect it...referred many sites, a guy had this same error but nobody managed to answer it convincingly. hope i get it right here... thank u in advance.

2
Contributors
5
Replies
28
Views
3 Years
Discussion Span
Last Post by Moschops
0

This means the function named identical with that signature cannot be found anywhere. If it's your own code, you haven't written that function. If it's some other code, you haven't linked that library.

0

The error indicates clearly that you do not have that function (or rather, the linker cannot find it, which means if you do have it, you're not telling the linker where to find it).

If you show us, for example, the relevant code, we can tell you more.

Edited by Moschops

0

this is the code:

#include "stdafx.h"
#include <cv.h>
#include <highgui.h>
using namespace cv;
using namespace std;
 bool identical(cv::Mat m1, cv::Mat m2);
int main(int argc, TCHAR *argv[])
{
     //initialize and allocate memory to load the video stream from camera 
     CvCapture *capture = cvCaptureFromCAM(0);

     if( !capture ) return 1;
    IplImage* frst = cvQueryFrame( capture );
    cv::Mat frstMat(frst); 
    bool result;
    //create a window with the title "Video"
    cvNamedWindow("Video");
    while(true)
    {
             //grab and retrieve each frames of the video sequentially 
            IplImage* frame = cvQueryFrame( capture );
             if( !frame ) break;
             cv::Mat framemat( frame ); 
             result = identical(frstMat, framemat);
             if( result == false ) 
                 printf( " Different image" );
             //show the retrieved frame in the "Video" window
             cvShowImage( "Video", frame );
             //wait for 40 milliseconds
             int c = cvWaitKey(40);
          //exit the loop if user press "Esc" key  (ASCII value of "Esc" is 27) 
            if((char)c==27 ) break;
   }
   //destroy the opened window
   cvDestroyWindow("Video");   
   //release memory
   cvReleaseCapture( &capture );
    return 0;
}
template<typename T>
bool identical(cv::Mat m1, cv::Mat m2) {
    if(m1.cols != m2.cols || m1.rows != m2.rows)
      return false;

    for(int i=0; i<m1.rows; i++)
    {
       for(int j=0; j<m1.cols; j++)
       {
          if(m1.at<T>(i, j) != m2.at<T>(i, j))
            return false;
       }
    }
    return true;
}

Edited by arunkishorres

0

That template function looks odd. Your code never specifies the kind of object that T is to be. A template function is generated at compile time by the compiler, so if the compiler doesn't like it, it won't generate it.

Edited by Moschops

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.