c++opencvvisual-studio-2015static-libraries.lib

OpenCV and Visual Studio 2015: Why is including the static library not working?


I'm trying to set up a VS2015 solution I have with OpenCV 3.0.0, and I'm trying to do so using static libraries only.

Header files: the OpenCV header files are included correctly and I can reference them in my source files without issue.

Libraries: the static library file that was created for me when I used CMake to build OpenCV (called "ippicvmt.lib") is included correctly, and loads without issue.

Using OpenCV in code: when I try to use OpenCV classes/functions in my solution, I get linker errors when building similar to

LNK2001:  unresolved external symbol "public: virtual double __thiscall cv::VideoCapture::get(int)const

I can right-click and choose "Go to definition" on my use of this function and it opens videoio.hpp and shows the declaration of the virtual method. The linker error I see is likely caused by the inability for visual studio to find the actual implementation of the method in the static library I have included in my solution.

It is my understanding that the only .lib file I need to include is the one static library file. That is all I have included right now.

Does anybody know why VS can't find the implementations of this code in the OpenCV static library?


Solution

  • I fixed my issue by disabling the flag for building with shared libs in CMake, after that way more .lib files show up in the sharedlib folder in my install. I added each .lib file I wanted to use to my additional dependencies in my project properties and my project built.