zxing-cpp icon indicating copy to clipboard operation
zxing-cpp copied to clipboard

Not compiling under VS 2013 IDE

Open baniuk opened this issue 10 years ago • 3 comments

Project generated by CMake: cmake -G "Visual Studio 12 2013" ..\ do not compile in VS2013 giving errors:

  • error C2039: 'max' : is not a member of 'std'
  • error C3861: 'max': identifier not found

Compilation in VS2012 IDE as well as by nmake (for VC2012 and VC2013) runs fine. I am not sure if it is problem with my config or cmake (tested with 3.1.x) or maybe something changed in IDE.

Can be fixed by adding #include <algorithm> in sources.

baniuk avatar Jan 28 '15 22:01 baniuk

This is a common change with vs12, include algorithm is the way to go: http://blogs.msdn.com/b/vcblog/archive/2013/06/28/c-11-14-stl-features-fixes-and-breaking-changes-in-vs-2013.aspx --> You must #include when calling std::min() or std::max()

SebGDev avatar Jan 29 '15 13:01 SebGDev

Thank you for clarification, I am wondering why cmake -G "Visual Studio 12 2013" ..\ && nmake runs without problems.

baniuk avatar Jan 29 '15 17:01 baniuk

I found some errors when using Visual Studio 2015, where you'd get the errors identified in this Stack Overflow page: http://stackoverflow.com/questions/31808256/multi-file-iostream-error-lnk2005-in-vs2015-with-za Following the advice on the page fixes it, setting Disable Language Extension back to No. (no /Za flag in CMakeLists.txt)

krampster avatar Jun 29 '16 04:06 krampster