使用std :: max [英] using std::max

查看:96
本文介绍了使用std :: max的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好


我正在按照加速C ++实践编程的练习进行操作

示例和使用时:


使用std :: max;我在MS Visual C ++ v6中得到这些编译错误


错误C2039:''max'':不是''std'的成员'

错误C2873:''max'':符号不能用于使用声明


我有#include''d< algorithm-但是看不到

那里。


max是一个相当新的标准库功能吗?我怎样才能使这个工作?


Angus

Hello

I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: ''max'' : is not a member of ''std''
error C2873: ''max'' : symbol cannot be used in a using-declaration

I have #include''d <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?

Angus

推荐答案

" Angus" < no **** @ gmail.comwrote:
"Angus" <no****@gmail.comwrote:

我正在关注加速C ++实践编程中的练习

示例和何时使用:


使用std :: max;我在MS Visual C ++ v6中得到这些编译错误


错误C2039:''max'':不是''std'的成员'

错误C2873:''max'':符号不能用于使用声明


我有#include''d< algorithm-但是看不到

那里。


max是一个相当新的标准库功能吗?我如何让它工作?
I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: ''max'' : is not a member of ''std''
error C2873: ''max'' : symbol cannot be used in a using-declaration

I have #include''d <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?



它不是相当新的当标准被批准时,是在那里

AFAIK。尝试使用不同的编译器。

It is not "fairly new" is was there when the standard was ratified
AFAIK. Try using a different compiler.


Angus写道:
Angus wrote:

你好


我正在关注加速C ++实践编程中的练习

示例和使用时:


使用std :: max;我在MS Visual C ++ v6中得到这些编译错误


错误C2039:''max'':不是''std'的成员'

错误C2873:''max'':符号不能用于使用声明


我有#include''d< algorithm-但是看不到

那里。


max是一个相当新的标准库功能吗?我如何让它工作?
Hello

I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:

using std::max; I get these compile errors in MS Visual C++ v6

error C2039: ''max'' : is not a member of ''std''
error C2873: ''max'' : symbol cannot be used in a using-declaration

I have #include''d <algorithm- but cannot see the function declared in
there.

Is max a fairly new standard library feature? How do I get this to work?



不,但VC6并不是很顺从。升级时间。


-

Ian Collins。

No, but VC6 isn''t very compliant. Time to upgrade.

--
Ian Collins.


1月23日,3:下午18点,Daniel T. < danie ... @ earthlink.netwrote:
On Jan 23, 3:18 pm, "Daniel T." <danie...@earthlink.netwrote:

" Angus" < nos ... @ gmail.comwrote:
"Angus" <nos...@gmail.comwrote:

我正在关注加速C ++实践编程中的练习

示例和使用时:
I am following the exercises in Accelerated C++ Practical Programming by
Example and when use:


使用std :: max;我在MS Visual C ++中得到这些编译错误v6
using std::max; I get these compile errors in MS Visual C++ v6


错误C2039:''max'':不是''std''的成员

错误C2873:''max'':符号不能用于使用声明
error C2039: ''max'' : is not a member of ''std''
error C2873: ''max'' : symbol cannot be used in a using-declaration


我有#include' 'd< algorithm-但是看不到

中声明的函数。
I have #include''d <algorithm- but cannot see the function declared in
there.


max是一个相当新的标准库功能吗?我如何让它发挥作用?它不是相当新的当标准被批准时是在那里
Is max a fairly new standard library feature? How do I get this to work?It is not "fairly new" is was there when the standard was ratified



AFAIK。尝试使用其他编译器。

AFAIK. Try using a different compiler.



正如其他人所指出的那样,VC6并不是特别符合b $ b标准。

(它毕竟是在C ++标准最终确定之前发布的。)


但是,在这种特殊情况下,你可能想检查是否

问题是冲突

与另一个头文件。例如,纯粹假设说话

(假设

总是在主题上?),windows.h定义了一个名为max的宏。你可以通过在包含windows.h之前定义符号NOMINMAX来关闭这个



It''s true, as others have pointed out, the VC6 was not especially
standards compliant.
(It was after all released before the C++ standard was finalized.)

However, in this particular case, you might want to check if the
problem is a conflict
with another header file. For example, speaking purely hypothetically
(hypotheticals
are always on topic right?), windows.h defines a macro named max. You
can turn this
off by defining the symbol NOMINMAX before you include windows.h.


这篇关于使用std :: max的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆