fatal error LNK1215: metadata operation failed when include dnn from opencv in c++ project on visual studio 2015
I got a project(including subprojects) that i want to build. I build first all subprojects, whereas i build the main project i got this error: I use Debug mode on x64 machine. When i build i got these errors (45):
CapturingForm.obj : error LNK2001: unresolved external symbol "public: virtual bool __cdecl cv::dnn::experimental_dnn_34_v7::Layer::getMemoryShapes(class std::vector<class std::vector<int,class std::allocator<int> >,class std::allocator<class std::vector<int,class std::allocator<int> > > > const &,int,class std::vector<class std::vector<int,class std::allocator<int> >,class std::allocator<class std::vector<int,class std::allocator<int> > > > &,class std::vector<class std::vector<int,class std::allocator<int> >,class std::allocator<class std::vector<int,class std::allocator<int> > > > &)const " (?getMemoryShapes@Layer@experimental_dnn_34_v7@dnn@cv@@UEBA_NAEBV?$vector@V?$vector@HV?$allocator@H@std@@@std@@V?$allocator@V?$vector@HV?$allocator@H@std@@@std@@@2@@std@@HAEAV56@1@Z)
1>ViewersLibCore_d.lib(OpenCVViewer.obj) : error LNK2001: unresolved external symbol "public: virtual bool __cdecl
cv::dnn::experimental_dnn_34_v7::Layer::getMemoryShapes(class std::vector<class std::vector<int,class std::allocator<int> >,class std::allocator<class std::vector<int,class std::allocator<int> > > > const &,int,class std::vector<class std::vector<int,class std::allocator<int> >,class std::allocator<class std::vector<int,class std::allocator<int> > > > &,class std::vector<class std::vector<int,class std::allocator<int> >,class std::allocator 15>LINK : fatal error LNK1215: metadata operation failed (8013119F) :
+++
.....
I suspect that something has to do with the opencv_dnn library, so i add it in additional dependencies of the project(+ the path). The problem is that, when i add opencv_dnn343.lib (Release mode) the errors reduced to 4 (from 45 that were before):
1>CalibrationGUI.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl cv::dnn::experimental_dnn_34_v7::Layer::forward(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,class cv::debug_build_guard::_OutputArray const &)" (?forward@Layer@experimental_dnn_34_v7@dnn@cv@@UEAAXAEBV_InputArray@debug_build_guard@4@AEBV_OutputArray@64@1@Z)
1>subproj.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl cv::dnn::experimental_dnn_34_v7::Layer::forward(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,class cv::debug_build_guard::_OutputArray const &)" (?forward@Layer@experimental_dnn_34_v7@dnn@cv@@UEAAXAEBV_InputArray@debug_build_guard@4@AEBV_OutputArray@64@1@Z)
1>ViewersLibsubproj_d.lib(OpenCVViewer.obj) : error LNK2001: unresolved external symbol "public: virtual void __cdecl cv::dnn::experimental_dnn_34_v7::Layer::forward(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,class cv::debug_build_guard::_OutputArray const &)" (?forward@Layer@experimental_dnn_34_v7@dnn@cv@@UEAAXAEBV_InputArray@debug_build_guard@4@AEBV_OutputArray@64@1@Z)
1>Path\x64\Debug\MainProject.exe : fatal error LNK1120: 1 unresolved externals
But, when i add the opencv_dnn343d.lib (for Debug mode) , instead of eliminate the errors i got this error:
MainProject.obj : error LNK2022: metadata operation failed (8013119F) : A TypeRef exists which should, but does not, have a corresponding TypeDef: (Impl): (0x01000038).
1>LINK : fatal error LNK1215: metadata operation failed (8013119F) :
I can't figure out a way for solving this. Any idea?