Std :: cin.ignore (std :: numeric_limits <std :: streamsize> :: max (), '\ n') when using #include <Windows.h>

In VS 2010 Pro, I get a compilation error with the "expected identifier" in the max () section of the command. It seems like the max (a, b) is listed in the windows.h header file and he wants to use it.

I also tried using #include, but that did not fix the problem.

Can I get around this?

+5
source share
1 answer

Title <windows.h>had macros min()and max()since time immemorial, and they often cause problems with C ++. Fortunately, you can turn them off by adding #define NOMINMAXbefore you turn them on <windows.h>.

+12
source

All Articles