为什么会报math.h里面的错呢?
添加头文件#include<math.h>,使用fabs。编译时竟然报头math.h文件的错误。
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(495): error C2059: 语法错误:“(”
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(495): error C2059: 语法错误:“-” 1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(495): error C2059: 语法错误:“)”
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(496): error C2143: 语法错误 : 缺少“;”(在“{”的前面)
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(496): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(499): error C2059: 语法错误:“(”
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(499): error C2059: 语法错误:“-”
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(499): error C2059: 语法错误:“)”
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(500): error C2143: 语法错误 : 缺少“;”(在“{”的前面)
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(500): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(547): error C2059: 语法错误:“(”
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(547): error C2059: 语法错误:“-”
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(547): error C2059: 语法错误:“)”
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(548): error C2143: 语法错误 : 缺少“;”(在“{”的前面)
1>c:\program files\microsoft visual studio 10.0\vc\include\math.h(548): error C2447: “{”: 缺少函数标题(是否是老式的形式表?)
报错地方的代码
template<class _Ty> inline _Ty _Pow_int(_Ty _X, int _Y) {unsigned int _N; if (_Y >= 0) _N = (unsigned int)_Y; else _N = (unsigned int)(-_Y); for (_Ty _Z = _Ty(1); ; _X *= _X) {if ((_N & 1) != 0) _Z *= _X; if ((_N >>= 1) == 0) return (_Y < 0 ? _Ty(1) / _Z : _Z); }}inline double __CRTDECL abs(_In_ double _X) {return (fabs(_X)); }inline double __CRTDECL pow(_In_ double _X, _In_ int _Y) {return (_Pow_int(_X, _Y)); }