OpenCV 无法解决 objdetect.hpp 函数的外部错误 (C++)
我正在尝试在 VS2010 中用 C++ 编译一个简单的人脸检测程序,并遇到两个 LNK 2019 错误:
错误2错误LNK2019:函数_main中引用了无法解析的外部符号_cvReleaseHaarClassifierCascade
错误 3 错误 LNK2019:函数“void __cdecl detectorFaces(struct _IplImage *)”中引用了无法解析的外部符号 _cvHaarDetectObjects (?detectFaces@@YAXPAU_IplImage@@@Z)
相关代码行:
cvReleaseHaarClassifierCascade( &cascade );
...
CvSeq *faces = cvHaarDetectObjects( img, cascade, storage, 1.1, 3, 0, /*CV_HAAR_DO_CANNY_PRUNNING*/ cvSize( 40, 40 ) );
我真的找不到很多关于这个特定问题的参考,我相信所有相关的库/目录都应该是解决方案。
当我转到函数定义时,它在 objdetect.hpp 中找到它们,但我不明白的是为什么我会收到这些 LNK 错误?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试也包含 opencv_objdetect220d.lib 。它就像一个魅力。
Try to include opencv_objdetect220d.lib too. It worked like a charm.
您是否已将库添加到链接依赖项中?
右键单击您的项目 ->属性->链接器->输入->附加依赖项
Have you added the libraries to your link dependencies?
right-click on your project -> Properties -> Linker -> Input -> Additional Dependencies