Article ID: 143208 - Last Review: August 3, 2001 - Revision: 1.0 PRB: Using STL in Windows Program Can Cause Min/Max ConflictsThis article was previously published under Q143208 SYMPTOMS
A windows-based program that uses the Standard Template Library (STL) will
not compile, and it generates several invalid parameter and syntax errors.
CAUSE
The problem is caused by conflicting definitions of min and max. Min and
max are defined as macros in Windef.h as follows:
Min and max are defined as templated functions in the Standard Template Library (STL). The following definitions of min and max can be found in the file Algobase.h: RESOLUTION
Simply define the NOMINMAX preprocessor symbol. This can be done in the
Developer Studio project under Build, Settings, on the C/C++ tab, in the
Preprocessor category. This will suppress the min and max definitions in
Windef.h.
STATUS
This behavior is by design.
| Article Translations
|

Back to the top
