错误 LNK2019:未解析的外部符号 _ 打开 CV 程序 [英] error LNK2019: unresolved external symbol _ Open CV program
问题描述
我正在学习开放简历,同样我尝试了几个程序.我指的是这个链接.http://docs.opencv.org/modules/contrib/doc/facerec/tutorial/facerec_gender_classification.html
I am learning open CV and for the same i was trying few programs. I am referring to this link. http://docs.opencv.org/modules/contrib/doc/facerec/tutorial/facerec_gender_classification.html
我正在使用 Visual Studio 10 来运行它,我想我在某个地方搞砸了一些配置.我在更多程序中面临同样的问题(来自同一来源),
I am using visual studio 10 to run the same, and i think somewhere i have messed up with some configuration. I am facing the same problem in couple of more programs (picked from same source) ,
我得到的错误如下:-
The error which i get is as follows:-
1>main.obj : error LNK2019: unresolved external symbol "int __cdecl cv::waitKey(int)" (?waitKey@cv@@YAHH@Z) 在函数 __catch$_main$0 中引用
1>main.obj : error LNK2019: unresolved external symbol "int __cdecl cv::waitKey(int)" (?waitKey@cv@@YAHH@Z) referenced in function __catch$_main$0
1>main.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::subspaceReconstruct(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArrayconst &)" (?subspaceReconstruct@cv@@YA?AVMat@1@ABV_InputArray@1@00@Z) 在函数 __catch$_main$0 中引用
1>main.obj : error LNK2019: unresolved external symbol "class cv::Mat __cdecl cv::subspaceReconstruct(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const &)" (?subspaceReconstruct@cv@@YA?AVMat@1@ABV_InputArray@1@00@Z) referenced in function __catch$_main$0
.....(更多此类未解决的外部符号错误)
..... (more such unresolved external symbol error)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::_InputArray::empty(void)const " (?empty@_InputArray@cv@@UBE_NXZ)
1>main.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::_InputArray::empty(void)const " (?empty@_InputArray@cv@@UBE_NXZ)
1>c:\users\isenses\documents\visual studio 2010\Projects\gender_classification\Debug\gender_classification.exe:致命错误 LNK1120:37 个未解析的外部
1>c:\users\isenses\documents\visual studio 2010\Projects\gender_classification\Debug\gender_classification.exe : fatal error LNK1120: 37 unresolved externals
1>
1>构建失败.
1>已用时间 00:00:00.36
1>Time Elapsed 00:00:00.36
========== 构建:0 个成功,1 个失败,0 个最新,0 个跳过 ==========
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
我的项目属性如下:-
属性->配置属性->调试->命令参数->C:\Users\isenses\Documents\Visual Studio 2010\Projects\gender_classification\csv.txt
Properties->Configuration Properties ->Debugging->command arguments->C:\Users\isenses\Documents\Visual Studio 2010\Projects\gender_classification\csv.txt
属性->配置属性->VC++目录->包含目录->(添加C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib&
C:\openCV_2.4\opencv\build\x86\vc10\lib)
Properties->Configuration Properties ->VC++ directories->Include directories->(added C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib
&
C:\openCV_2.4\opencv\build\x86\vc10\lib)
C/C++->general->additional include 目录(添加openCV的包含路径即:-C:\openCV_2.4\opencv\build
C/C++->general->additional include directories (added include path of openCV ie:- C:\openCV_2.4\opencv\build
链接器->常规---启用增量链接=no
Linker->General--- Enable incremental linking=no
附加库目录=C:\Program Files %28x86%29\Microsoft Visual Studio 10.0\VC\lib
Additional Library directories=C:\Program Files %28x86%29\Microsoft Visual Studio 10.0\VC\lib
C:\openCV_2.4\opencv\build\x86\vc10
C:\openCV_2.4\opencv\build\x86\vc10
链接器->系统---子系统=/SUBSYSTEM:CONSOLE
linker->System---SubSystem= /SUBSYSTEM:CONSOLE
链接器->输入---额外的依赖=wsock32.libopencv_contrib2411d.lib
Linker->Input--- additional dependencies= wsock32.lib opencv_contrib2411d.lib
opencv_calib3d2411d.lib
opencv_calib3d2411d.lib
opencv_ml2411d.lib
opencv_ml2411d.lib
opencv_objdetect2411d.lib
opencv_objdetect2411d.lib
谢谢.
推荐答案
感谢@miki,我能够成功构建文件.我的问题的解决方案是:-
Thanks to @miki i was able to build the file successfully. The solution to my problem was:-
- 在属性->链接器->输入中添加适当的附加依赖项.
- 在 Windows 环境变量中添加库路径.
- 我没有使用@miki 所指出的和他引用的适当的附加依赖项好吧,你还必须在链接器中链接 opencv_coreXXX、opencv_highguiXXX、opencv_imgprocXXX 等......(如果在调试中,尾随为d")->输入---附加依赖项"
再次感谢
这篇关于错误 LNK2019:未解析的外部符号 _ 打开 CV 程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!