错误C2084:函数'float cbrt(float)throw()'已经有一个正文

时间:2015-08-03 09:24:10

标签: c++ visual-studio-2010 visual-studio-2012

我在visual studio 2010的平台下成功完成了这个项目,但在vs 2013中出现了这些错误:

 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(1045) : see previous definition of 'cbrt'
d:\documents\qtprojecttest\rtsc\project4\trimesh2\include\Vec.h(657) : error C2084: function 'long double cbrt(long double) throw()' already has a body
 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(1161) : see previous definition of 'cbrt'
d:\documents\qtprojecttest\rtsc\project4\trimesh2\include\Vec.h(664) : error C2084: function 'float round(float) throw()' already has a body
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(1125) : see previous definition of 'round'
d:\documents\qtprojecttest\rtsc\project4\trimesh2\include\Vec.h(672) : error C2084: function 'long double round(long double) throw()' already has a body
 C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(1241) : see previous definition of 'round'
d:\documents\qtprojecttest\rtsc\project4\trimesh2\include\Vec.h(679) : error C2084: function 'float trunc(float) throw()' already has a body
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(1143) : see previous definition of 'trunc'
d:\documents\qtprojecttest\rtsc\project4\trimesh2\include\Vec.h(687) : error C2084: function 'long double trunc(long double) throw()' already has a body

我想知道为什么会有这样的差异,以及如何解决它?

1 个答案:

答案 0 :(得分:0)

为什么VS2010和VS2013会有这样的差异?因为VS2010没有定义" cbrt"但是Vs2013有。所以你可以使用_MSC_VER,或直接在Vec.h中注释重复函数体。