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就可以了


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM