0
votes

I'm using Visual Studio 2017.
I installed the NuGet opencvdefault package in my C++ project and after including and rebuilding the project I have these linker errors:

Error LNK2028 unresolved token (0A00091D) "public: void __cdecl cv::UMat::copySize(class cv::UMat const &)" (?copySize@UMat@cv@@$$FQEAAXAEBV12@@Z) referenced in function "public: __cdecl cv::UMat::UMat(class cv::UMat const &)" (??0UMat@cv@@$$FQEAA@AEBV01@@Z)
Error LNK2019 unresolved external symbol "public: void __cdecl cv::UMat::copySize(class cv::UMat const &)" (?copySize@UMat@cv@@$$FQEAAXAEBV12@@Z) referenced in function "public: __cdecl cv::UMat::UMat(class cv::UMat const &)" (??0UMat@cv@@$$FQEAA@AEBV01@@Z)
Error LNK2019 unresolved external symbol "public: void __cdecl cv::Mat::copySize(class cv::Mat const &)" (?copySize@Mat@cv@@QEAAXAEBV12@@Z) referenced in function "public: __cdecl cv::Mat::Mat(class cv::Mat const &)" (??0Mat@cv@@QEAA@AEBV01@@Z)
Error LNK1120 3 unresolved externals

A NuGet installation is not supposed to configure the correct libraries to link?

Project config: project config

NuGet package info: enter image description here

1
Did you check whether your projects setting "Runtime Library" match the one used in the nuget package? Sometimes you're trying to use "dynamic" libraries in a "static" project. - Wum
@Wum My project is dynamic library and I guess the opencvdefault NuGet is also dynamic, link to this NuGet here: nuget.org/packages/opencvdefault/3.1.0 - Pedro Ferreira

1 Answers

1
votes

Your project is set up for platform toolset v141 (Visual Studio 2017). The nuget package is build for platform toolset vc12 and vc14 (Visual Studio 2015 and earlier). Try switching your projects platform toolset to v140.
C++ Binary Compatibility between Visual Studio 2015 and Visual Studio 2019

If this platform toolset is not available you could install the v140 toolchain.