Unable to link with manually compiled OpenCV

I am migrating my software from OpenCv 3.2.0 to 4.10.0. I need to have support of the dnn_superres module. So I have to build OpenCV myself.

Thanks to this topic I successfully compiled the monolithic library. Here the release .LIB and .DLL i obtained:

Now when I build my software while linking with opencv_world4100.lib i get linking errors:

1>Core.lib(Image.obj) : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)
1>Core.lib(ForwardLighting.obj) : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)
1>AssetPanel.obj : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)
1>Core.lib(BaseModel.obj) : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)
1>Core.lib(RenderLights.obj) : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)
1>Core.lib(DX12Renderer.obj) : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)

However linking with the opencv_world4100.lib from OpenCV 4.10.0 .exe package works.

Please am i missing anything?

I have a workaround that is working:

  1. I use the opencv_world4100.lib from github .EXE package
  2. I manually compile a non monolithic build including the extra modules
  3. I link with opencv_dnn_superres4100.lib in addition to opencv_world4100.lib from OpenCV 4.10.0 .exe

This works but i would like to do the things properly. Especially since I would need to compile OpenCV with OPENCV_IMGCODECS_USE_OPENEXR enabled

your project is in DEBUG mode, the lib in RELEASE. bad fit, it expects special signatures, which are not there.

Hello Berak :slight_smile: Thank you very much for helping!

I mistaken I get these errors in Debug build.

So
Release build

I get this error
2>AssetPanel.obj : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::_InputArray const &,class cv::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@1@AEBV_OutputArray@1@HH@Z)

Debug build

I get these errors
2>Core.lib(Image.obj) : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)
2>Core.lib(ForwardLighting.obj) : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)
2>AssetPanel.obj : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)
2>Core.lib(BaseModel.obj) : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)
2>Core.lib(RenderLights.obj) : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)
2>Core.lib(DX12Renderer.obj) : error LNK2001: unresolved external symbol “void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)” (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z)

Thanks!