dnn unresolved external symbol during linking [closed]

asked 2018-10-23 17:01:45 -0600

yancey gravatar image

updated 2018-10-23 17:03:31 -0600

I am using OpenCV 4.0.0-pre in my C++ project, Visual Studio 2015 Win32. I have an issue when linking to opencv dnn.

I have 2 copies of opencv on my computer. They were both from github, in version 4.0.0-pre. But I got them a few weeks apart so the source code had a few different commits.

I used one opencv (opencvA) to test my project. It was built locally. My project was to include and link opencvA. Every thing worked fine.

Then I tried to use the other opencv (opencvB) to work my project (I could have stick to opencvA, but I did a new download from github instead). It was built remotely by Jenkins, using the same version of Visual Studio and same configuration. All header files, libs and dlls were deployed on my computer. When I tried link opencvB, it gave me errors such as:

error LNK2001: unresolved external symbol "class cv::dnn::dnn4_v20180917::Net __cdecl cv::dnn::dnn4_v20180917::readNet(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?readNet@dnn4_v20180917@dnn@cv@@YA?AVNet@123@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00@Z)
error LNK2001: unresolved external symbol "public: __int64 __thiscall cv::dnn::dnn4_v20180917::Net::getPerfProfile(class std::vector<double,class std::allocator<double> > &)" (?getPerfProfile@Net@dnn4_v20180917@dnn@cv@@QAE_JAAV?$vector@NV?$allocator@N@std@@@std@@@Z)

The error only happens to DNN module. The Core module was linked without problem. When I dump the DNN lib file from opencvB, function signatures are such as:

class cv::dnn::dnn4_v20180903::Net __cdecl cv::dnn::dnn4_v20180903::readNet(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::vector<unsigned char,class std::allocator<unsigned char> > const &,class std::vector<unsigned char,class std::allocator<unsigned char> > const &)

The timestamp, 20180903 and 20180917, mismatch. The functions from opencvB have signatures with 20180903, but my project was trying to find signatures with 20180917. I checked my include path. My project include opencvB, not opencvA, so I should be using the correct header files. I also cleaned old object files in my project.

Any ideas what is causing the issue and how to fix it? Also could anyone explain why timestamp is append to function signatures in the DNN module? Thanks.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by yancey
close date 2018-10-25 09:41:31.799394

Comments

1

Just for experiment, try to swap them (build opencvB locally but opencvA in Jenkins).

dkurt gravatar imagedkurt ( 2018-10-24 02:17:17 -0600 )edit

@dkurt, thanks. I found out I made a mistake in my building script, which messed up the deployed lib files. It works now.

yancey gravatar imageyancey ( 2018-10-25 09:41:12 -0600 )edit