您的位置:首页 > 编程语言 > C语言/C++

[C++] std::numeric_limits::max() error: '(': illegal token on right side of '::'

2011-05-23 14:34 661 查看
#include <limits>

x = std::numeric_limits<int>::max();

c:/.../x.cpp(192) : warning C4003: not enough actual parameters for macro 'max'
c:/.../x.cpp(192) : error C2589: '(' : illegal token on right side of '::'
c:/.../x.cpp(192) : error C2059: syntax error : '::'

错误原因:

包含的另一个头文件中包含了 max() 的宏定义。

解决方法:

添加代码:

#undef max

相关讨论:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐