void new_doubles(double a, double b, double c)
{
double d=max(abs(a), abs(b), abs(c));
cout<<d;
}
“不是在这个范围内声明”产生此编译时错误:得到一个错误
In file included from /usr/local/gcc4.9.0/include/c++/4.9.0/bits/char_traits.h:39:0,
from /usr/local/gcc4.9.0/include/c++/4.9.0/string:40,
from /usr/local/gcc4.9.0/include/c++/4.9.0/stdexcept:39,
from /usr/local/gcc4.9.0/include/c++/4.9.0/array:38,
from std_lib_facilities_4.h:27,
from hw4pr4.cpp:1: /usr/local/gcc4.9.0/include/c++/4.9.0/bits/stl_algobase.h: In instantiation of ‘const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = double; _Compare = double]’:
hw4pr4.cpp:35:36: required from here
/usr/local/gcc4.9.0/include/c++/4.9.0/bits/stl_algobase.h:264:26: error: ‘__comp’ cannot be used as a function
if (__comp(__a, __b))
我不明白为什么这个错误被生产谁能帮助解释我做错了什么?
您的标题说“未在此范围内声明”(并且消息周围缺少引号使您的标题非常难以阅读)。该消息未显示在您的问题的正文中。此外,请更新您的问题以显示完整的代码示例。你的实际代码必须有一个或多个'#include'指令;我们需要看到他们。 – 2014-10-06 22:43:07