ms vc ++ iostream编译错误

bri*_*ian 4 c++ visual-studio

以下代码在microsoft visual C++ 2010中表达:

#include <iostream>
//using namespace std;

int main(int argc, char **argv)
{


 return(0);

}
Run Code Online (Sandbox Code Playgroud)

给了我错误:

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(41): fatal error C1003: error count exceeds 100; stopping compilation
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

如果注释掉"#include"则编译.我从现有代码创建了一个项目并编辑到上面.

小智 16

将扩展名从更改.c.cpp


小智 6

对不起,我的英语不好.

我使用此配置参数解决了同样的问题:

  1. 工具栏 - >项目 - >属性(或Alt + F7).
  2. 配置属性 - > C/C++ - >高级.
  3. 编译为

如果在"编译为"字段中输入值"编译为C代码",则必须将其更改为"默认"或"编译为C++代码".

我希望我一直很有帮助

最好的祝福