Opencv Visual studio 2017 simple hack installation

Opencv in Visual studio 2017

This tutorial shows you how to use and install OPENCV 3 + in Visual Studio 2017. It is more hack than a proper install. Use Nuget packages in package console is a simple installation of opencv without setting of environmental variables and additional troubles with installation. All Visual Studio Versions needs its own build of Opencv library also the Nuget packages. VS 2012 needs a version of libs V110. If you match following pictures together you have my point.. VC12 libs is version for Visual studio 2013. VC14 is lib version for Visual Studio 2015. Finally, Visual Studio 2017 needs platform toolset and lib version V141. In opencv prebuild libs we need to wait to VC141. Hopefully. I never get the point of this naming convention. Visual studio year and V140 141 110 120 but.. The current release is more confusing than the others.

opencv VS141

Opencv library has prebuild versions in that location after install.

opencv visual studio 2017

If you want to VC141 libs you need to build by CMAKE and Visual studio 2017 like in my older tutorial.. Same approach but switch visual studio version..
Build opencv for new version of Visual Studio in cmake

Opencv visual studio 2017 and older toolset

The best approach is set the toolset in Visual studio project to V140 and use a prebuild version of opencv libs for VS 2015 or use Nuget packages in simple 2 minutes installation also for version 2015 and enjoy coding in Visual studio 2017 until somebody solves and builds the libs in VS 2017. 

Follow and enjoy coding. Build own opencv is necessary in case using the embedded and specific HW. In case of coding on windows its better to wait for prebuild libs than install CMake on windows machine.. 

Opencv Visual studio 2017 Step by step image tutorial

opencv VS141

opencv visual studio 2017opencv C ++ VS141

Opencv nuget package console Visual studio 2017

Previous step are really simple. Just openc empty project in C++ and add one source file source.cpp.. There is no magic and nothing to block you to start coding.. Just follow the pictures and let me know if any problems occurred. 
Add some program, for example this for capture video from web camera.. If you try to build and link.. You will failed with no resolve dependency.. Now is the time to add. Opencv library.. Nuget is the simplest option..

Now open the Nuget packages console TOOLS-NUGET Package Manager and Package Manager console.. Do not afraid of console..

opencv visual studio 2017

 In console just write PM>  Install-Package opencvdefault 
ONLY part start with Install..  and wait until your includes in visual studio is resolved and we see that the packages are successfully installed. We are not finished!!

opencv visual studio 2017

Now, if you try to build and link you will have trouble with linking.. Right click to Project name Opencv and go to general settings and change platform support to v140 to 2015.. If you do not  have this V140 you need to install something like compatibility pack.. platform toolchain for VS140..

opencv visual studio 2017

Compile, link and run.. Webcam is here.. It is a hack, no proper installation for VS141 but there is no reason for it.. There is no difference. Better hack than build by CMAKE on windows machine if you are not skilled enough.

Enjoy coding in Visual studio 2017.

opencv visual studio 2017


  1. hi
    i cant have Nuget packages on tootls
    please can you help me?

  2. Very helpful suggestions that help in the optimizing website. Thank you for valuable suggestions.Powershell Studio 2017

  3. I have I need the platform toolchain for VS140
    I'm getting Linker error 2019

  4. Bro you save my life, runing OK!!!


Post a Comment