• Download the OpenCV 4.1.1-x64 zip here.
  • Right click the downloaded folder and press “Extract All…”. Then press “Extract.”
  • Go to the start menu and type “environment”. Then press “Edit the system environment variables.”
  • You should now see a window that looks like the one below:
  • Press “Environment Variables…,” click on “Path,” and then press “Edit…”:
  • Now press “New” and then “Browse…” and find the location of the OpenCV bin folder (for me it’s inside the downloaded OpenCV folder, and then inside x64 > mingw > bin. Click on this bin folder and press “Ok” to add it to the computer’s Path. Then be sure to exit by pressing “Ok” on each of the windows you opened (otherwise the changes may not be saved). This whole step just helps the computer easily find some important OpenCV files.
  • Restart your computer (if you don’t, the steps below won’t work properly)
  • Follow the “Configuring VS Code” and “Test Code” section on the C++ Development Configuration (Windows) page to make sure VS Code and C++ are properly set up.
  • In the explorer menu on the left, you should now have a tasks.json file, a c_cpp_properties.json file and (maybe) a launch.json file within the .vscode folder:
  • If you don’t have a c_cpp_properties.json file (like above), press Ctrl + Shift + P and search for “C/C++: Edit Configurations (UI)” and click on that. The file should then automatically appear.
  • Click on tasks.json and replace the “args” section with this (or add it in):
            "args": [
  • Replace “D:\OpenCV\Lib\include” with the location of the OpenCV include folder on your computer.
  • Replace “D:\OpenCV\Lib\x64\mingw\bin” with the location of the OpenCV bin folder on your computer.
  • Click on c_cpp_properties.json and update the “includePath” so that it also contains the OpenCV include folder. Now my “includePath” looks like this (yours will be different depending on where the include folder is located on your computer):
            "includePath": [