1. (Step by Step) Install OpenCV 3.3 with Visual Studio 2015 on Windows 10 x64 (2017 DIY)

(Step by Step) Install OpenCV 3.3 with Visual Studio 2015 on Windows 10 x64 (2017 DIY)

Hey Friends,

I am starting my own blog series on OpenCV Development Tutorials and this being my first post. As many of you may have wondered, the most difficult and frustrating part of working on any programming language is not to learn how to code but how to correctly setup your environment. Over the years of my programming experience, i have always hated scenario’s where i am troubleshooting or diagnosing environment build issues from setting up the environment variables to correctly building the libraries from source. My intention using blog as a medium of communication is to *NOT WASTE* anymore precious time of yours and get you up and running smoothly.

#Update 26 November 2017

If you would like to save all your time and the hassle of going through all of this, you can follow the below blog post to download the OpenCV 3 Headers and Libraries and using them without any compilation or issues.

(Easy & Fast) Pre-Compiled OpenCV Libraries and Headers for 3.2 with Visual Studio 2015 x64 Windows 10 Support

First thing first, it is very important to note that for OpenCV there are two options available as a part of build process.

a) Using the Pre-Built Libraries

b) Compiling from the Source

While, the former used to be my favorite approach uptill version 2.10, i later realized that latter should be your approach because 1) Pre-built libraries won’t work straight out visual studio 2015 and 2)  it gives you more clarity with your build environment and also makes you feel more comfortable with the technology when you start things from scratch.

Without any further delay, let’s start the process. In this blog post, we’ll focus on #b.

I. Pre-Requisites

  • Visual Studio 2015 (Community or Professional or Express)
  • OpenCV 3.3 Libraries (Download Here)

It has two folders:
Build – this contains the includes; also the prebuilt libs and dlls that work with a particular version of Visual Studio.
Sources – source code for OpenCV; also contains sample code and data

II. Installation

  1. Validate Visual Studio 2015

First, make sure you have a working Visual Studio 2015 setup. In order to test everything works out, you can try to run below sample program and confirm that the compiler doesn’t have any issues. This would avoid long time struggle of identifying if it’s the issue with OpenCV or Visual Studio.

  • From top menu of Visual Studio, File –> New –> Project. You get a pop up window, New Project.
  • Under Visual C++ , Select Win32 -> Win32 Console Application.
  • Click Next and Select “Empty Project” and Finish
  • Right click the “Source Files” and Select “ADD” and click “New Item”
  • Select “C++ File” and give it  a name “test”
  • Paste the below code in the file and hit F5 or Ctrl + F5
#include "stdafx.h"
#include "iostream"
using namespace std;

int main(){
cout "Hello World\n";
return 0;

If you are able to successfully run the code, then everything is good up till here. In rare scenarios and where Windows Software Development Kit for Windows 10 is not installed, the code would fail complaining that it didn’t find the C++ Compiler, go ahead and install the required dependencies and you should be good.

2. Extract the OpenCV binaries into a folder under c:\opencv_git

3.  Install CMake and open the CMake-GUI from the Start Menu and configure it in the following way:

  • Source Code will be your extracted directory = C:/opencv_git
  • Build the binaries= C:/opencv_git/mybuild (create a new folder)
  • Hit the configure button.
  • Specify the Generator for the project, the default “Visual Studio 14 2015 Win64” in our case (remember to use Win64 for x64 built of binaries)
  • Use default native compilers, Click Finish button.
  • At this point you will see log being generated in the bottom box of the CMake tool. If all goes well, you should see a configuration success message.
  • You should see a long list of items with red-pink background.
  • Accept the default selections without any modifications.
  • Finally click on the Generate button and you should see contents in your build directory once, it finishes.



 Ok, so we are half way through, stay put, 80% job is done, and we just need to do one more step to get this up and running.

4. Compile CMake generated binaries using Visual Studio Compiler

  • Open the Build Folder where we created the Half-baked OpenCV binaries and you should see a file named as “OpenCV.sln”. This is visual studio 2015 file, so double click on it and you should see visual studio 2015 popping up for you.
  • The goal here is to get both Debug and Release binaries and libraries built. First, we’ll use the Debug configuration, so make sure Debug is selected from the configuration manager.


  • Right Click the “ALL_BUILD” selection in Solution Explorer and click “BUILD”. It is going to take some time, and here is chance for you to grab that coffee or drink that you have been waiting for. This will build the appropriate xxxxx330d.lib, xxxxx330d.exp and xxxxx330d.pdb files.
  • Once, this is done, swap configurations (Debug <–> Release) so Release is selected, then Right Click on ALL_BUILD again and select Build. Time for the washroom break after that drink that you had previously. This will build all xxxxx330.lib, xxxxx330.exp and xxxxx330.dll files.
  • After both sets of builds are complete, Expand the “CMakeTargets” folder within Solution Explorer and Right click on “INSTALL” and then Build once more. This will join both Debug and Release libraries into a single “lib” and “bin” folder. This would save tons of extra work for your reverse build environments.

  • Hurray, this completed the Compilation process and you should see compiled binaries and libraries under C:\opencv_git\mybuild\install\x86\vc14\bin and C:\opencv_git\mybuild\install\x86\vc14\lib respectively.


5. Validate OpenCV Windows 10 build Environment

  • Now, that we have built the OpenCV binaries and libraries, it’s time to get into action and run a demo program for which we did all the hardwork. Let’s get that to work.

Note: For any OpenCV project, you have to tell the C/C++ compiler where the OpenCV header files are, and you have to tell the Linker system where the compiled OpenCV library files are located. This should be your first step while working on any OpenCV projects, otherwise you will get annoying “File Not Found” error messages.

  • If you haven’t closed your Visual Studio instance, create a New Empty Project and add a new Source.cpp file to Sources.
  • Select the configuration mode as “Release”.
  • In the Solution Explorer, right click the project title and open the Properties.

  • On the Configuration Properties, C/C++, General settings for Additional Include Directories, enter “C:\opencv_git\mybuild\install\include\”
  • On the Configuration Properties, Linker, General settings for Additional Library Directories, enter “C:\opencv_git\mybuild\install\x86\vc14\lib”
  • On the Configuration Properties, Linker, Input, Additional Dependencies, add the following libraries:
  • NOTE: There are SEPARATE Property entries, depending on if you are in Debug or Release mode.
  • And finally, you have to add the .dll library locations to the Environment Variables / System Variables PATH. In this case I’ve added both C:\opencv_git\mybuild\install\x86\vc14\bin and C:\opencv_git\mybuild\install\x86\vc14\lib to Path entry.

Note: Visual Studio 2015 contains VC14 compiler which is used with OpenCV thus we are going to use vc14 folder from OpenCV installation.

Here is the test code, that i wrote which will simply open up your webcam and display live feed.

#include "opencv2/opencv.hpp"
#include "opencv2/opencv.hpp"
#include "opencv\highgui.h"
using namespace cv;
int main()
Mat image;          //Create Matrix to store image
VideoCapture cap;          //initialize capture
namedWindow("window", 1);          //create window to show image
while (1)
cap &gt;&gt; image;          //copy webcam stream to image
imshow("window", image);          //print image to screen
waitKey(30);          //delay 30ms
return 0;

OpenCV 2.4 & 3.0 Cheatsheet and Differences (C++)

25 thoughts on “(Step by Step) Install OpenCV 3.3 with Visual Studio 2015 on Windows 10 x64 (2017 DIY)”

  1. sap dejq says:

    Dear, I’m following your instalation but my cMake is not recognized and the opencv_world330d.lib is not recognized by the system.

    what wrong?

    1. Editor says:

      can you elaborate at what process your cMake is not recognized? are not able to install it properly or you are not able to launch it from the start menu? Also, you wouldn’t use opencv_world file unless you are using pre-complied opencv version. As per the blog post, you should have different Library files such as :

  2. sap says:

    Hi, the problem is here : when I want to reconfigure the cmake

    CMake Error: The source directory “C:/OpenCV/opencv” does not appear to contain CMakeLists.txt.
    Specify –help for usage, or press the help button on the CMake GUI.


    1. Editor says:

      Ok, so you have to use the “sources” folder in the first section. Let’s say you have extracted the opencv zip under “C:\opencv\3.2\opencv\” (pay attention to the folder structure), then you have to enter the “C:/opencv/3.2/opencv/sources” as the “Where is the source” in CMake-GUI. If you open that folder, you should see a CMakeList file there.

  3. Editor says:

    In your case, i think it should be : C:/OpenCV/opencv/sources , make sure sources folder has the “CMakeLists.txt” file in it. That should work

  4. Flo says:

    Hi, I’m following all the steps but at the end I have this error: Error LNK1181 cannot open input file ‘opencv_hal330.lib’. and when I look in my build folder mybuild\install\x64\vc14\lib I don’t find this library. Have i to restart a step or restart since the beginning?

    Thank you for your help

    1. Editor says:

      opencv_hal330.lib is a typo, you can ignore it and we don’t need it for fully functioning. Hal.cpp is already a part of core.h include. Safely remove it.

  5. Hi,I check your blogs named “(Step by Step) Install OpenCV 3.3 with Visual Studio 2015 on Windows 10 x64 (2017 DIY) | World of OpenCV, AI, Computer Vision and Robotics Examples and Tutorials” daily.Your story-telling style is witty, keep up the good work!

    1. Editor says:

      Thank you for the feedback.

  6. Dfs says:

    Hey, thank you very much for this tutorial, it is really great and easy to do the step by step.
    However, when I try to run the test code, it says “cannot open input file ‘opencv_core330.lib'”. Any idea what might be wrong?

  7. JustADude says:

    Hey, thank you very much for this tutorial, it is really great and easy to do the step by step.
    However, when I try to run the test code, it says “cannot open input file ‘opencv_core330.lib'”. Any idea what might be wrong?

    1. Editor says:

      can you navigate to “C:\opencv_git\mybuild\install\x86\vc14\lib” and check what all Lib files you have in there? Do you see any file with core in it?

  8. Editor says:

    Checkout our latest Support Vector Machines Tutorial @ (Best and Easy) Support Vector Machines(SVM) + HOG Tutorial | OpenCV 3.0, 3.1, 3.2, 3.3 | Windows 10 | Visual Studio 2015 | x64 | Train & Test @ http://pythonopencv.com/best-and-easy-support-vector-machinessvm-hog-tutorial-opencv-3-0-3-1-3-2-3-3-windows-10-visual-studio-2015-x64-train-test/

    1. Daryl M says:

      Hey thank you for this tutorial! i have a little bit of problem though. i tried the test code for live feed webcam that you gave, but then an error showed up saying cannot open input file ‘opencv_core330.lib’. I have open “C:\opencv_git\mybuild\install\x64\vc14\lib” and there i found ‘opencv_core330d.lib’. i do not know what’s wrong.

  9. Daryl M says:

    sorry for asking again, i have found the problem from my last comment. But then it showed another error. i got error code “LNK2001 unresolved external symbol “void __cdecl cv::imshow(class cv::String const &,class cv::_InputArray const &)” (?imshow@cv@@YAXAEBVString@1@AEBV_InputArray@1@@Z) opencv test2 C:\Users\Lenovo\Documents\Visual Studio 2015\Projects\opencv test2\opencv test2\Source.obj 1 ”

    do you know how to solve this problem?

    1. Editor says:

      Are you using x64 project build and also debug build since you are not using release binaries?

      1. Editor says:

        If you select debug build.. You have to re link the opencv includes…

    2. Editor says:

      Ok i was able to reproduce your issue, you are missing almost all the Linker Input files.
      The specific one that threw that error was opencv_highgui330.lib. Please make sure you have all the Linker Input files.
      Following the #5. from this article and add all the relevant one’s.
      Whenever you see any unresolved external symbol errors, that means you are missing on the External Dll’s or Libs.
      Hope this helps

  10. Daryl M says:

    I have done it now ! Thank you so much for the help!

  11. Hwi Yu says:

    I can not find a OpenCV.sln at MyBuild folder after successfully

    Installed CMake and open the CMake-GUI from the Start Menu and configure it.

    please advise me.


    1. Editor says:

      were there any errors while you pressed either the configure or generate button in CMKAE-GUI? or have you correctly followed the document?

Leave a Reply

Your email address will not be published. Required fields are marked *

Welcome to OpenCV World !! Come as a Guest, stay as a Family