size_t size = std::numeric_limits< unsigned long >::max();在vc7.1下编译老是报下面的错误:
error C2589: “(” : “::”右边的非法标记
error C2059: 语法错误 : “::”哪位高手解答一下,谢谢!!!

解决方案 »

  1.   

    6也无所谓,知道什么原因吗?
    我用的stl是stlport4.6.2的库
      

  2.   

    将< unsigned long >中间的空格去掉试试。
      

  3.   

    奇怪,这种写法是MSDN的例子啊,怎么会编不过呢?
      

  4.   

    就算是int也不行啊,不关unsigned long什么事
      

  5.   

    Compiler Error C2589
    'identifier' : illegal token on right side of '::'The token on the right side of the scope resolution operator (::) was not legal.Only a member of a class (or structure or union) can be on the right side of the scope resolution operator if a class name is on the left side. Otherwise, any global identifier can be on the right side.
      

  6.   

    max带什么参数?不要乱说!!!#include <limits>加了
      

  7.   

    没用过这个函数,试试(::max())
      

  8.   

    //没用过这个函数,试试(::max())哪有这个函数?
      

  9.   

    呵呵,就是。用vc7.1自带的stl也编译通过不了,迷漫!!!
      

  10.   

    问题的原因是:std::numeric_limits< unsigned long >::max()是一个静态函数,与全局的宏max(a,b)冲突了,你只要屏蔽掉这个全局宏就没问题了.
    解决方法:在工程设置里添加一个预定义宏 
    Project setting ——>C/C++——>Category——>PreProcessor——>PreProcessor Definitions(此处添加预定义编译开关 NOMINMAX)