• Advertisement

Archived

This topic is now archived and is closed to further replies.

limits and windows.h a no no?

This topic is 5311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

limits doesn't seem to like windows.h, or vice versa. For some strange reason, this does not compile:
#include <windows.h>
#include <limits>

int main()
{
	std::numeric_limits<char>::max();
}
 
The compiler (.NET 2003 standard) says: : warning C4003: not enough actual parameters for macro 'max' : error C2589: '(' : illegal token on right side of '::' : error C2143: syntax error : missing ';' before '::' If I don't include windows.h, it compiles just fine. What's wrong?! Edit: < > [edited by - Matsen on October 8, 2003 4:11:35 AM]

Share this post


Link to post
Share on other sites
Advertisement

#define NOMINMAX
#include <windows.h>
#include <limits>

int main()
{
std::numeric_limits::max();
}


Edit: Thanks neoztar

[edited by - Matsen on October 8, 2003 4:20:36 AM]

Share this post


Link to post
Share on other sites

  • Advertisement