• 8190阅读
  • 1回复

[提问]求助,Eclipse+QT,报错:'pow' is not a member of 'std' [复制链接]

上一主题 下一主题
离线lf2hl
 

只看楼主 倒序阅读 楼主  发表于: 2011-02-25
一个函数:
void PlotSettings::adjustAXis(double &min, double &max, int &numTicks)
{
const int MinTicks = 4;
double grossStep = (max - min) / numTicks;
double step = std::pow(10.0, std::floor(std::log10(grossStep)));
if (5 * step < grossStep)
{
  step *= 5;
}
else if (2 * step < grossStep)
{
  step *= 2;
}
numTicks = int(std::ceil(max / step) - std::floor(min / step));
if (numTicks < MinTicks)
{
  numTicks = MinTicks;
}
min = std::floor(min / step) * step;
max = std::ceil(max / step) * step;
}
编译报错:
Description Resource Path Location Type
'ceil' is not a member of 'std' Plotter.cpp /plotter line 385 C/C++ Problem
'ceil' is not a member of 'std' Plotter.cpp /plotter line 391 C/C++ Problem
'floor' is not a member of 'std' Plotter.cpp /plotter line 374 C/C++ Problem
'floor' is not a member of 'std' Plotter.cpp /plotter line 385 C/C++ Problem
'floor' is not a member of 'std' Plotter.cpp /plotter line 390 C/C++ Problem
'log10' is not a member of 'std' Plotter.cpp /plotter line 374 C/C++ Problem
'pow' is not a member of 'std' Plotter.cpp /plotter line 374 C/C++ Problem
mingw32-make: *** [debug] Error 2 plotter    C/C++ Problem
mingw32-make[1]: *** [debug/plotter.o] Error 1 plotter    C/C++ Problem
注:我已在include中加入了MinGW的相关路径 如图。
离线wter27
只看该作者 1楼 发表于: 2011-02-27
ceil' is not a member of 'std' Plotter.cpp /plotter line 385 C/C++ Problem
ceil不是std的成员类型。仔细看下是不是ceil是成员函数什么的,是不是引用错误?
max = std::ceil(max / step) * step;?
快速回复
限100 字节
 
上一个 下一个