cin.ignore(numeric_limits<streamsize>::max(), '\n'); max() not recognize it

c++

Solution

This is because in Visual Studio when you use the windows includes it will define a macro max(). If you hover over the max() in your example you should receive an intellisense warning. You can solve this problem by undefining max after all your includes and before any code.

#undef max

Problem

I'm taking an intro to C++, and I'm using VStudio 2013 on Win7. I try to avoid the wrong data input from my menus, and it's working in all of them except this one. ``` cout << "Please choose your second number" << endl; cin >> move2; if (move2 < 1 || move2 > size) { cout << "That's not a valid move" << endl; Sleep(2000); cin.sync(); cin.clear(); } ``` the only difference is that in the condition for move > a variable (size) not a number. When I enter a char it goes back to the question asking for another input, but if I enter a word, it breaks! I try to use `cin.ignore(numeric_limits<streamsize>::max(), '\n');` but the compiler highlights `max()` and it says "expecting identifier". It maybe easy for all of you good programmers, but I don't know how to fix it. Can anybody help me?

Original source