1
votes

Hello Im trying to use OpenCV 3.0 with Visual Studio 2015 Enterprise but for some reason it is not working, what am I doing wrong ?

First of all I have OpenCV extracted in C:\opencv\ with 7z archive

  1. In Visual Studio Project -> TestProject Properties

Configuration -> All Configuration && Platform -> All Platform

  1. Configuration Properties -> VC++ Directory -> Include Directories => C:\opencv\opencv\build\include
  2. Configuration Properties -> VC++ Directory -> Library Directories => C:\opencv\opencv\build\x86\vc12\lib
  3. Configuration Properties -> C/C++ -> General -> Additional Include Libraries => C:\opencv\opencv\build\include
  4. Configuration Properties -> Linker -> General -> Additional Library Directories => C:\opencv\opencv\build\x86\vc12\bin

Configuration -> Debug && Platform -> All Platform

  1. Configuration Properties -> Linker -> Input -> Additional Dependencies =>

opencv_ts300d.lib

opencv_world300d.lib

Configuration -> Release && Platform -> All Platform

  1. Configuration Properties -> Linker -> Input -> Additional Dependencies =>

opencv_ts300.lib

opencv_world300.lib


Now when I run a sample code I get MSVCP120D.dll is missing and MSVCR120D.dll is missing and cannot open input file 'kernel32.lib' errors. Does anyone had the same problem or know a solution ?

2
You need opencv built with vs 2015 compiler, which is not in the prebuilt binaries. So you need to recompile opencv. There are a lot of duplicates of this questionMiki
@Miki sadly none of them was detailed and I was always feeling like missing an important point each time I try an answer. (Of course there could be others but I have read like top 15 of them from google search results)Kaan O

2 Answers

1
votes

MSVCP120D.dll One option is install redistributable Packages for older Visual Studio. And include this libs directly in your app from ProgramFiles/MicrosoftSDK/Windows/version/libs. This path find simply during the instalation. This is for Visual studio 2013 here Package Here

Better is recompile opencv with cmake and visual studio.

Build opencv with Visual Studio 2015 compiler from source first. This reduce a risk that older framework missing in your computer. You need vc14 directory as a source of your libs. Prebuild libs are only for VS 2012 and 2013, which is VC11 and VC12 libs folder under your opencv/build/x64 or x86. Speps are simple.

  1. Download CMAKE, install
  2. Download source code of Opencv, extract
  3. run Cmake and add directory of your source and target directory for your project.
  4. Configure Cmake just choose right compiler VS2015 first. There is many options. Just try the default one first.
  5. Run Cmake. Result is Visual Studio 2015 project like opencv.sln under target directory.
  6. Open opencv.sln project
  7. Build this project with Visual Studio 2015. Result is VC14 directory with libs to include.

Check this picture by picture tutorial. Tutorial Here

Also you can use NUGET console Tutorial Nuget opencv

1
votes

To fix "MSVCP120D.dll is missing and MSVCR120D.dll" please download them and put here C:\Windows\System32