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

  • 相关阅读:
    多帐套,多组织 登录系统设计
    Git常用命令速查05
    一步步搭建java信息管理系统00
    Git常用命令速查04
    Git常用命令速查03
    Git常用命令速查02
    Git常用命令速查01
    无法创建k/3中间层组件或组件正在调用中间层问题解决
    jQuery.i18n.properties实现前端国际化
    ORACLE telnet 1521 不通及ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务的解决
  • 原文地址:https://www.cnblogs.com/mothe123/p/2755722.html
Copyright © 2011-2022 走看看