shimat / opencvsharp

OpenCV wrapper for .NET
Apache License 2.0
5.22k stars 1.13k forks source link

Meet many LNK2019 and LNK2001 when build OpenCVSharpExtern.dll #1549

Closed sanicle closed 1 year ago

sanicle commented 1 year ago

Summary of your issue

Meet many LNK2019 and LNK2001 when build OpenCVSharpExtern.dll in Visual Studio.

Creating library G:\VSProjects\ImageProcess\opencvsharp-master\opencvsharp-master\src\Debug\Win32\OpenCvSharpExtern.lib and object G:\VSProjects\ImageProcess\opencvsharp-master\opencvsharp-master\src\Debug\Win32\OpenCvSharpExtern.exp 1>wechat_qrcode.obj : error LNK2019: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) referenced in function "private: void thiscall std::vector<class cv::KeyPoint,class std::allocator >::_Construct_n<class cv::KeyPoint const &,class cv::KeyPoint const &>(unsigned int,class cv::KeyPoint const &,class cv::KeyPoint const &)" (??$_Construct_n@ABQAVKeyPoint@cv@@ABQAV12@@?$vector@VKeyPoint@cv@@V?$allocator@VKeyPoint@cv@@@std@@@std@@AAEXIABQAVKeyPoint@cv@@0@Z) 1>xfeatures2d.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) 1>ximgproc.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) 1>xphoto.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) 1>text.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) 1>tracking.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) 1>video.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z)

Environment

Windows 10 Visual Studio 2022

What did you do when you faced the problem?

build OpenCVSharpExtern.dll

Output:

Creating library G:\VSProjects\ImageProcess\opencvsharp-master\opencvsharp-master\src\Debug\Win32\OpenCvSharpExtern.lib and object G:\VSProjects\ImageProcess\opencvsharp-master\opencvsharp-master\src\Debug\Win32\OpenCvSharpExtern.exp 1>wechat_qrcode.obj : error LNK2019: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) referenced in function "private: void thiscall std::vector<class cv::KeyPoint,class std::allocator >::_Construct_n<class cv::KeyPoint const &,class cv::KeyPoint const &>(unsigned int,class cv::KeyPoint const &,class cv::KeyPoint const &)" (??$_Construct_n@ABQAVKeyPoint@cv@@ABQAV12@@?$vector@VKeyPoint@cv@@V?$allocator@VKeyPoint@cv@@@std@@@std@@AAEXIABQAVKeyPoint@cv@@0@Z) 1>xfeatures2d.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) 1>ximgproc.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) 1>xphoto.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) 1>text.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) 1>tracking.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z) 1>video.obj : error LNK2001: unresolved external symbol "void cdecl cv::error(int,class std::basic_string<char,struct std::char_traits,class std::allocator > const &,char const ,char const ,int)" (?error@cv@@YAXHABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PBD1H@Z)

sanicle commented 1 year ago

I have already solved this. The solution default configured as "Debug" but the lib files are "Release". When switch to "Release" it will be all OK but if I want a debug version I would have to recompile OpenCV470 by myself.