[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
相关讨论:
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
相关讨论:
相关文章推荐
- Problem calling std::max: Illegal token on right side of ::
- 'numeric_limits' is not a member of 'std'
- [C++] std::numeric_limits::max() error: '(': illegal token on right side of '::'
- 'numeric_limits' is not a member of 'std'|
- Error 1 error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::
- cocos2d-x-2.2.5 Eclipse编译报错 error: 'transform' is not a member of 'std' (IOS没有问题)
- MySQL不能删除外键,抱错Error on rename of './ruler/test2child' to './ruler/#sql2-298-92' (errno: 152)
- c++编译 extra qualification '类名' on member '变量名' error
- C++报错集合:error: 'CppUnit::TestFixture' is an inaccessible base of 'LMQueryConnectionTest'
- terminate called after throwing an instance of 'std::logic_error' [aidl] what(): basic_string
- c++ error: reference to 'plus' is ambiguous ; template<class _Tp> struct std::plus
- 解决 C++错误 error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class CString' (or there is no
- 运行时错误:terminate called after throwing an instance of 'std::logic_error'
- Blitz++ error: 'labs' is not a member of 'std'
- error C2352: 'CView::OnInitialUpdate' : illegal call of non-static member function
- error: ISO C++ forbids declaration of 'XXXX' with no type
- sbjson解析json数据遇到JSONValue failed. Error is: Illegal start of token [Ô]解决办法
- 错误 1 error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'std::str
- error: ISO C++ forbids declaration of 'XXXX' with no type
- C2679: binary '<<' : no operator found which takes a right-hand operand of type 'const std::basic