Build OpenCV 4.1.1 from source Raspbian OS. OpenCV 4.x requires c++11

Failure for cmake command when building opencv from source. Output at link bellow → https://i.stack.imgur.com/V9HYR.png
Any clues on how to get past this? Default standard used by cmake seems to be c++14. I know I should change it or somehow overwrite the defaults for cmake but I don’t know how.

Hi,

try this

set (CMAKE_CXX_STANDARD 11)

Hello, I did try adding the parameter to the top of the CMakeLists.txt file, however the result is unchanged.

I tried this for vs 2017

-DCMAKE_CXX_FLAGS=/std:c++17

and I find this flag in cmakeoutput in C++ flags (Release): /std:c++17 /D _CRT_SECURE_NO_DEPRECATE…

of course you must give the good flag for your compiler