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

不羁岁月 提交于 2019-12-02 07:11:26

问题


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?


回答1:


Have you added the libraries to your link dependencies?

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




回答2:


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



来源:https://stackoverflow.com/questions/4826044/opencv-unresolved-external-errors-with-objdetect-hpp-functions-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!