在我的代码中,我使用了在 math.h 中定义的 DBL_MAX
。在 VS2010 中它工作正常,但在 VS2008 中出现错误:
error: C2065: 'DBL_MAX' : undeclared identifier
DBL_MAX 在 VS2008 中可用吗?
最佳答案
原来我是个笨蛋,我应该检查实际的标题 - 它在 float.h 中,而不是 math.h 中。似乎 math.h 在 VS2010 中包含 float.h 但在 VS2008 中不包含。
让我感到困惑的是它在 VS2010 中工作,所以我只是假设 DBL_MAX 它不适用于 VS2008。
所以添加它解决了问题:
#include <math.h>
#include <float.h>
我发布这个是为了防止其他人犯同样的错误。
关于c++ - 错误 : C2065: 'DBL_MAX' : undeclared identifier (in VS2008 but not in VS2010),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28427495/