OpenCV unresolved external errors with objdetect.hpp functions (C++)

Nemekh picture Nemekh · Jan 28, 2011 · Viewed 7.1k times · Source

I'm trying to compile a simple face detection program in C++ in VS2010 and have come across two LNK 2019 errors:

Error 2 error LNK2019: unresolved external symbol _cvReleaseHaarClassifierCascade referenced in function _main

Error 3 error LNK2019: unresolved external symbol _cvHaarDetectObjects referenced in function "void __cdecl detectFaces(struct _IplImage *)" (?detectFaces@@YAXPAU_IplImage@@@Z)

Relevant code lines:

cvReleaseHaarClassifierCascade( &cascade );

...

  CvSeq *faces = cvHaarDetectObjects(  img,  cascade,  storage,  1.1,  3,  0, /*CV_HAAR_DO_CANNY_PRUNNING*/  cvSize( 40, 40 ) );

I couldn't really find many references to this particular issue and I believe all the relevant libraries/directories are as they should be for the solution.

When I go to the function definitions it finds them in objdetect.hpp but what I don't understand is why I'm getting these LNK errors?

Answer

Patrizio Bertoni picture Patrizio Bertoni · Jul 28, 2012

Try to include opencv_objdetect220d.lib too. It worked like a charm.