可能重复:
在 VS2010 中编译旧 C++ 代码时出现 cmath 编译错误 在 VS2010 中
编译失败,因为 C++ 程序在 Linux 中构建良好
我正在用 C++ 创建一个程序,我需要在其中读取一个文本文件。我已经包含了 fstream 头文件,它允许我打开文件,但是添加了包含后,我现在收到无数与 math.h 相关的错误功能。例子:
1>c:\program files\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: syntax error : identifier 'acosf'
1>c:\program files\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: syntax error : ';'
有什么方法可以在不影响 math.h 函数的情况下包含 fstream 的文本文件读取函数?为什么会发生这种冲突呢?
/编辑/
似乎错误在 cmath 标准头文件中。这不是我可以访问的,但为了完成,这里是导致错误的代码:
using _CSTD acosf; using _CSTD asinf;
using _CSTD atanf; using _CSTD atan2f; using _CSTD ceilf;
(等等)