Compiler errors involving min() and max() macros

Article ID: 842
Last updated: 05 Feb, 2008
Article ID: 842
Last updated: 05 Feb, 2008
Revision: 1
Views: 2904
Posted: 08 Sep, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


I have compiler errors involving min() and max() functions or macros. The errors may appear as follows.
C:
ogue
w
wtime.h(311) : warning C4003: not enough actual parameters for macro 'max'
C:
ogue
w
wtime.h(311) : error C2059: syntax error : '('
C:
ogue
w
wtime.h(311) : error C2535: RTime::RWTime(void)' : member function already defined or declared



Cause


Microsoft defines its own macros called min() and max(). This is the default behavior. Tools.h++ has some methods by the same name. Microsoft's default behavior is to expand these methods as if they were macros. This causes compile errors for code using Tools.h++.


Action


Define the preprocessor macro NOMINMAX for your project.
This article was:   Helpful | Not helpful
Report an issue
Article ID: 842
Last updated: 05 Feb, 2008
Revision: 1
Views: 2904
Posted: 08 Sep, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category