1

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?

Nemekh
  • 35
  • 1
  • 5
  • Does the project you are compiling knows the location of the library where the library is present? – programmer Jan 28 '11 at 08:13
  • PATH: C:\Program Files (x86)\OpenCV2.2\bin Library dir: C:\Program Files (x86)\OpenCV2.2\vs2010Build\lib\Debug Additional dependencies: C:\Program Files (x86)\OpenCV2.2\vs2010Build\lib\Debug\opencv_core220d.lib C:\Program Files (x86)\OpenCV2.2\vs2010Build\lib\Debug\opencv_highgui220d.lib C:\Program Files (x86)\OpenCV2.2\vs2010Build\lib\Debug\opencv_video220d.lib C:\Program Files (x86)\OpenCV2.2\vs2010Build\lib\Debug\opencv_ml220d.lib C:\Program Files (x86)\OpenCV2.2\vs2010Build\lib\Debug\opencv_legacy220d.lib C:\Program Files (x86)\OpenCV2.2\vs2010Build\lib\Debug\opencv_imgproc220d.lib – Nemekh Jan 28 '11 at 08:19
  • Sorry, character limit and lack of formatting may make that harder to read. I believe the above should be sufficient as it's been fine for other openCV projects I've used thus far – Nemekh Jan 28 '11 at 08:21

2 Answers2

5

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

Patrizio Bertoni
  • 2,582
  • 31
  • 43
3

Have you added the libraries to your link dependencies?

right-click on your project -> Properties -> Linker -> Input -> Additional Dependencies

Martin
  • 968
  • 3
  • 10
  • 19
  • 3
    I realised that a lack of caffeine this morning made forget to add as an additional dependency opencv_objdetect220d.lib Thanks, it did prompt me to cross reference what I had already vs libraries in the folder left over – Nemekh Jan 28 '11 at 09:06