OpenCV 4.x+ plus VS 2012 error - requires enabled C++11 support

Hello. I used this tutorial - Installation by Making Your Own Libraries from the Source Files - OpenCV: Installation in Windows
to build a library OpenCV 4.5.2 for Visual Studio 2012

Go to the build directory and open the created OpenCV solution. Depending on just how much of the above options you have selected the solution may contain quite a lot of projects so be tolerant on the IDE at the startup. Now you need to build both the Release and the Debug binaries. Use the drop-down menu on your IDE to change to another of these after building for one of them.

I get the error C: \ lib2 \ opencv \ modules \ core \ include \ opencv2 / core / cvdef.h (736): fatal error C1189: #error: “OpenCV 4.x + requires enabled C ++ 11 support”

I’d recommend upgrading Visual Studio in any case.

you could figure out whether C++11 is enabled in the VS project.

it is checking your c++ compiler / version, and tells us, your compiler wo’nt work with latest master branch.

you can try to:

  • upate your VS
  • fall back to the opencv 3.4 branch which does not rely so heavily on c++11 (git checkout 3.4)