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

  • 相关阅读:
    Intellijidea建javaWeb以及Servlet简单实现
    PHP关于文件与文件夹(1) 写入文件 文件权限 三、锁定文件
    mysql 时间戳格式化函数from_unixtime使用说明
    Ansible 2.0公布
    如何获取板子上独有的ID号EXYNOS4412/Imx6ul【转】
    2.7 xargs和exec详解【转】
    __setup 在内核中的作用【转】
    Linux __setup解析【转】
    c语言中 %p的含义【转】
    函数 devm_kzalloc()【转】
  • 原文地址:https://www.cnblogs.com/mothe123/p/2755722.html
Copyright © 2011-2022 走看看