📅 2015-Oct-26 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ error, max, min ⬩ 📚 Archive
C++ code using the
std::max can fail with a cryptic error message when compiled with Visual Studio on Windows:
error C2589: '(' : illegal token on right side of '::'
This is caused if you are including
windows.h. That header defines these as old-style macros.
To indicate that these macros not be defined, define
NOMINMAX before including that header:
#define NOMINMAX #include <windows.h>
Tried with: Visual Studio 2015 and Windows 7 x64