OpenCV2.2+VC2005 error LNK2019错误解决办法

原创
2016-06-07 15:49:12 2051浏览

环境OpenCV2.2+vs2005+XP 按照官网提供的安装配置方法,对VS2005的环境进行了设置,但是调试程序时,编译通过却出现链接错误,如下: 1opencvhello.obj : error LNK2019: 无法解析的外部符号 "int __cdecl cv::waitKey(int)" ( ?waitKey@cv@@YAHH@Z ),该符

环境OpenCV2.2+vs2005+XP

按照官网提供的安装配置方法,对VS2005的环境进行了设置,但是调试程序时,编译通过却出现链接错误,如下:

1>opencvhello.obj : error LNK2019: 无法解析的外部符号 "int __cdecl cv::waitKey(int)" (?waitKey@cv@@YAHH@Z),该符号在函数 _wmain 中被引用
1>opencvhello.obj : error LNK2019: 无法解析的外部符号 "void __cdecl cv::imshow(class std::basic_string,class std::allocator > const &,class cv::Mat const &)" (
?imshow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABVMat@1@@Z),该符号在函数 _wmain 中被引用
1>opencvhello.obj : error LNK2019: 无法解析的外部符号 "void __cdecl cv::namedWindow(class std::basic_string,class std::allocator > const &,int)" (
?namedWindow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z),该符号在函数 _wmain 中被引用
1>opencvhello.obj : error LNK2019: 无法解析的外部符号 "class cv::Mat __cdecl cv::imread(class std::basic_string,class std::allocator > const &,int)" (
?imread@cv@@YA?AVMat@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z),该符号在函数 _wmain 中被引用
1>opencvhello.obj : error LNK2019: 无法解析的外部符号 "void __cdecl cv::fastFree(void *)" (
?fastFree@cv@@YAXPAX@Z),该符号在函数 "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ) 中被引用
1>opencvhello.obj : error LNK2019: 无法解析的外部符号 "public: void __thiscall cv::Mat::deallocate(void)" (
?deallocate@Mat@cv@@QAEXXZ),该符号在函数 "public: void __thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ) 中被引用
1>D:/test/opencv/opencvhello/Debug/opencvhello.exe : fatal error LNK1120: 6 个无法解析的外部命令

错误原因:库文件设置不正确

解决办法:项目->属性->连接器->输入->附加依赖项,添加程序所依赖的库文件,本程序用到opencv_core220d.lib 和opencv_highgui220d.lib

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。