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

环境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<char,struct std::char_traits<char>,class std::allocator<char> > 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<char,struct std::char_traits<char>,class std::allocator<char> > 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<char,struct std::char_traits<char>,class std::allocator<char> > 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

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值