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

  • 相关阅读:
    [jQuery]jQuery DataTables插件自定义Ajax分页实现
    [.NET Core].NET Core R2安装教程及Hello示例
    PHP openssl加密扩展使用总结
    PHP 运行方式(PHP SAPI介绍)
    SQL用法操作合集
    PHP mcrypt加密扩展使用总结
    PHP header函数的几大作用
    JS中的Navigator 对象
    数据在内存中存储的方式:大端模式与小端模式
    C++中各种数据类型占据字节长度
  • 原文地址:https://www.cnblogs.com/mothe123/p/2755722.html
Copyright © 2011-2022 走看看