zoukankan      html  css  js  c++  java
  • error LNK2019: 无法解析的外部符号,解决办法

    最近在看一个程序,每次编译时都会出现

    chushihua.obj : error LNK2019: 无法解析的外部符号 "void __cdecl cv::imshow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::_InputArray const &)" (?imshow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV_InputArray@1@@Z),该符号在函数 "void __cdecl mouseEvent(int,int,int,int,void *)" (?mouseEvent@@YAXHHHHPAX@Z) 中被引用
    1>chushihua.obj : error LNK2019: 无法解析的外部符号 "void __cdecl cv::destroyWindow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?destroyWindow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z),该符号在函数 "void __cdecl InitialVideo(class cv::Mat &,class cv::Rect_<int> &)" (?InitialVideo@@YAXAAVMat@cv@@AAV?$Rect_@H@2@@Z) 中被引用
    1>chushihua.obj : error LNK2019: 无法解析的外部符号 "int __cdecl cv::waitKey(int)" (?waitKey@cv@@YAHH@Z),该符号在函数 "void __cdecl InitialVideo(class cv::Mat &,class cv::Rect_<int> &)" (?InitialVideo@@YAXAAVMat@cv@@AAV?$Rect_@H@2@@Z) 中被引用
    1>chushihua.obj : error LNK2019: 无法解析的外部符号 "void __cdecl cv::setMouseCallback(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,void (__cdecl*)(int,int,int,int,void *),void *)" (?setMouseCallback@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@P6AXHHHHPAX@Z1@Z),该符号在函数 "void __cdecl InitialVideo(class cv::Mat &,class cv::Rect_<int> &)" (?InitialVideo@@YAXAAVMat@cv@@AAV?$Rect_@H@2@@Z) 中被引用
    1>chushihua.obj : error LNK2019: 无法解析的外部符号 "public: virtual __thiscall cv::VideoCapture::~VideoCapture(void)" (??1VideoCapture@cv@@UAE@XZ),该符号在函数 _main 中被引用
    1>chushihua.obj : error LNK2019: 无法解析的外部符号 "public: virtual bool __thiscall cv::VideoCapture::isOpened(void)const " (?isOpened@VideoCapture@cv@@UBE_NXZ),该符号在函数 _main 中被引用
    1>chushihua.obj : error LNK2019: 无法解析的外部符号 "public: __thiscall cv::VideoCapture::VideoCapture(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0VideoCapture@cv@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z),该符号在函数 _main 中被引用
    1>D:\code\chushihua\Debug\chushihua.exe : fatal error LNK1120: 7 个无法解析的外部命令

    通过在网上查资料,是缺少库文件,我的编程环境是VS2008+OpenCV2.3,所以加上

    #pragma comment( lib, "opencv_highgui231d.lib")
    #pragma comment( lib, "opencv_core231d.lib")就可以了

    一般遇到这种问题就是缺少库文件,在头文件后面加入#pragma comment( lib, "*****.lib")就OK

  • 相关阅读:
    在HTML5中,用getCurrentPosition()获取用户的当前位置
    邮件设置 ssl://smtp.exmail.qq.com:465 can not connect to the SMTP server
    IIS绑定中文域名
    destoon 会员状态栏不显示
    汉诺塔的移动--python递归实现
    微星 msi B450迫击炮+2600X+RX588 3A平台装机
    正则表达式-1
    接口--php对接农行网上支付平台-b2b
    python----字符串操作函数
    php面试题--1
  • 原文地址:https://www.cnblogs.com/mothe123/p/2755722.html
Copyright © 2011-2022 走看看