VS 报cmath(19): error C2061: 语法错误: 标识符“acosf” 错误

这是因为我在.c文件中用了

#include <iostream>

using namespace std;

这样编译的时候就报:

出现错误类型如下:
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: 语法错误: 标识符“acosf”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: 语法错误:“;”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: 语法错误: 标识符“asinf”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: 语法错误:“;”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2061: 语法错误: 标识符“atanf”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2059: 语法错误:“;”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2061: 语法错误: 标识符“atan2f”
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(20): error C2059: 语法错误:“;”

 

解决方案是:

将.c后缀改为.cpp就可以了

文章来自:http://www.cnblogs.com/AI-Algorithms/p/3956645.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3