unresolved externals after custom build (vs14)

asked 2016-03-10 12:49:41 -0500

bbb gravatar image

updated 2016-03-10 12:51:33 -0500

The newest OpenCV comes prebuilt only as 64-bit. I have started with a working MSVS2010/OpenCV 3 rc1 project (32-bit). I am upgrading to VS2015/OpenCV 3.1.0 (32-bit).

I successfully built the OpenCV shared libraries using CMake and the vs14 toolkit. So far, so good.

Back in my project, I have added the libraries, and they are presumably found. I have even tried to ensure that they are loaded with #pragma in a respective cpp file (to no different effect):

pragma comment(lib, "opencv_core310d.lib") ...

I get unresolved externals in many of those respective files. For example:

error LNK2019: unresolved external symbol "int __cdecl cv::operator-(class cv::MatConstIterator const &,class cv::MatConstIterator const &)"
error LNK2001: unresolved external symbol "public: virtual class cv::Mat __thiscall cv::_InputArray::getMat(int)const "
error LNK2001: unresolved external symbol "public: __thiscall cv::Exception::Exception...

With my build of opencv, I can create a new project, add the apparently same configuration (done with importing the same property sheet I made for OpenCV dependencies), and e.g. construct a cv::Exception. That results in no errors. I am adding core, and imgproc among a few others.

The linker reports just 39 of those unique unresolved symbols in a sizable project (duplicated for 294 total errors). If I do remove my configuration properties for OpenCV, the number of unresolved symbols jumps to 82 (for 712 errors).

I'm at a loss to why this is happening - what is the problem here?

edit retag flag offensive close merge delete


please avoid using #pragma to add libraries, as you never get a proper error message, if this fails

berak gravatar imageberak ( 2016-03-10 12:54:40 -0500 )edit

As I said, I have a property sheet for the dependencies. I do not use #pragma in my project. I tried to add a #pragma to see what happens, nothing changed.

bbb gravatar imagebbb ( 2016-03-10 13:08:36 -0500 )edit