c++ - 错误 : C2065: 'DBL_MAX' : undeclared identifier (in VS2008 but not in VS2010)

标签 c++ visual-studio visual-studio-2008 compiler-errors

在我的代码中,我使用了在 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/

相关文章:

C++ 服务器收到太多请求,我想一次接受一些请求

c++ - 为什么在 C++ 中将 "using namespace"包含到头文件中是个坏主意?

c++ - Arduino 是否完全支持 C++ 标准库?

c++ - POD 和模板

c++ - Visual Studio 2008,运行时库使用建议

visual-studio-2008 - Visual C++ 2008 运行时的 xcopy 安装

visual-studio - 查找完整注释的文件

visual-studio - 在单个 TFS 项目下存储多个产品是个坏主意吗?

c# - 如何在不重新编译 VS2008 中的解决方案的情况下热交换引用的 DLL?

c# - 在我的 Azure 示例解决方案 AspProviders 中,项目 StorageClient 不可用