[Solved] std::max() error C2589: ‘(‘ : illegal token on right side of ‘::‘

int max =std::numeric_limits< int>: max();
:: Based on error indicating:

f:\code\cpp\webspider\main. cpp(47): warning C4003: not enough actual parameters for macro ‘max’

f:\code\cpp\webspider\main. cpp(47) : error C2589: ‘(‘ : illegal token on right side of ‘::’

f:\code\cpp\webspider\main. cpp(47) : error C2059: syntax error : ‘::’

Cause: STL’s numeric_limits::max() and VC6 min/max macro conflict.

The problem should be that the macro definitions of the above two header files conflict.

Solution: Use parentheses “()” to avoid precompiler errors. int max = (std::numeric_limits<std::streamsize>::max)(); That’s it.

Read More: