'min (& max) not a member of std' errors when building OpenCV 2.4.6 on Windows 8 for Visual Studio 2012

后端 未结 3 758
眼角桃花
眼角桃花 2020-12-10 01:23

I\'m trying to build OpenCV 2.4.6 on Windows 8 in Visual Studio 2012. Having downloaded the source from https://github.com/Itseez/opencv I generate (leaving the default conf

相关标签:
3条回答
  • 2020-12-10 02:02

    I was stumbling on the same issue while compiling OpenEXR. Then I found the solution googling for openexr std::min.

    There is an issue opened on OpenCV where it says that, when using VS2013 Preview, you must add the line #include <algorithm> in the file where you're using std::min and std::max.

    I put that line into the files where these methods are called and voilà! Compilation succeeded.

    0 讨论(0)
  • 2020-12-10 02:13
    #include <iostream> 
    #include <algorithm>
    

    Just include above 2 lines to the cpp file and the compilation error will disappear.

    0 讨论(0)
  • 2020-12-10 02:15

    You probably need to #define NOMINMAX. Try putting it before any other includes.
    If that helps, then put in the you project's preprocessor defines.

    There's lots of info about this, just search for NOMINMAX. Here's one post about it.

    0 讨论(0)
提交回复
热议问题