【发布时间】:2011-09-28 01:08:37
【问题描述】:
我正在尝试仅使用标准库将一些 VC++ 6 代码转换为控制台应用程序,但我从 MinGW 收到以下错误(Code::Blocks 10.05 IDE 提供的任何版本):
error: 'min' is not a member of 'std'
这和下面这行代码有关:
L.Precision=std::min(1.e-4,0.001*res);
L.Precision 是 double,res 是 double。以前这行是:
L.Precision=min(1.e-4,0.001*res);
但这给出了错误:
error: 'min' was not declared in this scope
以下是相关文件中的标题:
#include<stdio.h>
#include<math.h>
//#include<algorithm.h>
#include <malloc.h>
#include "complex.h"
#include "mesh.h"
#include "spars.h"
#include "FemmeDocCore.h"
我知道这可能与文件windef.h 中定义的一些宏有关,但如果我对此有误,请纠正我。
对此我能做些什么呢?我对 C++ 比较陌生,甚至不确定在哪里调用 windef.h,我认为这只是每个 Windows 程序都需要的,并且在某些时候由 MinGW 添加。我希望最终的代码是跨平台的。
【问题讨论】: