简体   繁体   English

OpenCV错误:LNK2019

[英]OpenCV error: LNK2019

I'm using OpenCV 2.4.6 and Visual Studio 2008 with Windows8.1 x86. 我正在使用OpenCV 2.4.6和Windows 8.1 x86的Visual Studio 2008。 When I debug my program it signal me 9 errors: 当我调试程序时,它提示我9个错误:

1>FYD_control.obj : error LNK2019: unresolved external symbol "int __stdcall cv::waitKey(int)" (?waitKey@cv@@YGHH@Z) referenced in function _main
1>FYD_control.obj : error LNK2019: unresolved external symbol "void __stdcall cv::imshow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::_InputArray const &)" (?imshow@cv@@YGXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV_InputArray@1@@Z) referenced in function _main
1>FYD_control.obj : error LNK2019: unresolved external symbol "double __stdcall cv::threshold(class cv::_InputArray const &,class cv::_OutputArray const &,double,double,int)" (?threshold@cv@@YGNABV_InputArray@1@ABV_OutputArray@1@NNH@Z) referenced in function _main
1>FYD_control.obj : error LNK2019: unresolved external symbol "void __stdcall cv::cvtColor(class cv::_InputArray const &,class cv::_OutputArray const &,int,int)" (?cvtColor@cv@@YGXABV_InputArray@1@ABV_OutputArray@1@HH@Z) referenced in function _main
1>FYD_control.obj : error LNK2019: unresolved external symbol "void __stdcall cv::medianBlur(class cv::_InputArray const &,class cv::_OutputArray const &,int)" (?medianBlur@cv@@YGXABV_InputArray@1@ABV_OutputArray@1@H@Z) referenced in function _main
1>FYD_control.obj : error LNK2019: unresolved external symbol "void __stdcall cv::fastFree(void *)" (?fastFree@cv@@YGXPAX@Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ)
1>FYD_control.obj : error LNK2019: unresolved external symbol "int __stdcall cv::_interlockedExchangeAdd(int *,int)" (?_interlockedExchangeAdd@cv@@YGHPAHH@Z) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ)
1>FYD_control.obj : error LNK2019: unresolved external symbol "void __stdcall cv::error(class cv::Exception const &)" (?error@cv@@YGXABVException@1@@Z) referenced in function "public: int & __thiscall cv::Mat::at<int>(int,int)" (??$at@H@Mat@cv@@QAEAAHHH@Z)
1>C:\Users\___________________________\Debug\FYD2_Control.exe : fatal error LNK1120: 8 unresolved externals
1>Build log was saved at "file://c:\Users\_________________\Debug\BuildLog.htm"
1>FYD2_Control - 9 error(s), 0 warning(s)

I've analized everything and I've noticed that while in this errors I have 我已经分析了所有内容,并且注意到在发生此错误时

(?waitKey@cv@@YGHH@Z)
(?imshow@cv@@YGXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV_InputArray@1@@Z)
(?threshold@cv@@YGNABV_InputArray@1@ABV_OutputArray@1@NNH@Z)
(?cvtColor@cv@@YGXABV_InputArray@1@ABV_OutputArray@1@HH@Z)
(?medianBlur@cv@@YGXABV_InputArray@1@ABV_OutputArray@1@H@Z)
(?fastFree@cv@@YGXPAX@Z)
(?_interlockedExchangeAdd@cv@@YGHPAHH@Z)
(?error@cv@@YGXABVException@1@@Z)

if I analize the .lib there is the same, but with A instead the first G 如果我对.lib进行分析,则相同,但是用A代替第一个G

(?waitKey@cv@@YAHH@Z)
(?imshow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV_InputArray@1@@Z)
(?threshold@cv@@YANABV_InputArray@1@ABV_OutputArray@1@NNH@Z)
(?cvtColor@cv@@YAXABV_InputArray@1@ABV_OutputArray@1@HH@Z)
(?medianBlur@cv@@YAXABV_InputArray@1@ABV_OutputArray@1@H@Z)
(?fastFree@cv@@YAXPAX@Z)
(?_interlockedExchangeAdd@cv@@YAHPAHH@Z)
(?error@cv@@YAXABVException@1@@Z)

Substituting the A with G in the .lib I solve this problem, but later it gives me an other error 我在.lib中用G替换了A,但我后来解决了这个问题

The procedure entry point ?fastFree@cv@@YGXPAX@Z could not be
located in the dynamic link library

How can I solve this? 我该如何解决?

Sorry for my english and thank's to anyone will answer. 对不起,我的英语,谢谢大家的回答。

you have problem with linking. 您在链接时遇到问题。 replacing A with G in your library wont help. 用库中的G替换A不会有帮助。 Make sure that you have added all libraries in additional dependencies. 确保已在其他依赖项中添加了所有库。 Below are the most necessary lib files make sure you have included it. 以下是最必要的lib文件,请确保已将其包括在内。

highgui210d.lib 
cxcore210d.lib 
cv210d.lib

Once you have done this if u still get error then go to lib folder of opencv (C:\\opencv\\build\\x86\\vc12\\lib) and add all the lib files to additional dependencies (right click on your project select properties->configuration properties->linker->input then on right pane locate additional dependencies then add all lib file names) of your project. 如果您仍然遇到错误,请完成此操作,然后转到opencv的lib文件夹(C:\\ opencv \\ build \\ x86 \\ vc12 \\ lib),然后将所有lib文件添加到其他依赖项中(右键单击您的项目,选择属性->配置属性->链接器->输入,然后在右窗格中找到项目的其他依赖项,然后添加所有lib文件名)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM