一个函数:
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的相关路径 如图。