std::numeric_limits<int>::max() error C2589: '(' : illegal token on right side of '::' 解决办法

int max =std::numeric_limits<int>::max();
     根据错误提示:

f:codecppwebspidermain.cpp(47) : warning C4003: not enough actual parameters for macro 'max'
f:codecppwebspidermain.cpp(47) : error C2589: '(' : illegal token on right side of '::'
f:codecppwebspidermain.cpp(47) : error C2059: syntax error : '::'
原因:STL的numeric_limits::max()和VC6 min/max 宏冲突问题

问题应该是以上两个头文件的宏定义出现了冲突。

解决:通过括号“()”来避免预编译器报错。int max = (std::numeric_limits<std::streamsize>::max)();   即可。
原文地址:https://www.cnblogs.com/wenshanzh/p/3586412.html