VS2010 compiler and cuda error: linkage specification is incompatible with previous “hypot”

荒凉一梦 提交于 2019-12-23 17:39:30

问题


When I try to build my project on a 64 bit Windows 7 using VS 2010 in Debug 64 bit configuration I get this error along with two other errors.

error: linkage specification is incompatible with previous "hypot" in math.h line 161 error: linkage specification is incompatible with previous "hypotf" in math.h line 161 error: function "abs(long long)" has already been defined in math_functions.h line 534

I do not get these errors in the 32 bit build. Also, the 64 bit build worked in VS2008. Is there a proper work around to this problem or should I just wait till nvcc supports VS 2010 compiler?


回答1:


Yes, this was changed in VS2010:

/* hypot and hypotf are now part of the C99 Standard */
static __inline double __CRTDECL hypot(_In_ double _X, _In_ double _Y)
{
    return _hypot(_X, _Y);
}

Not sure about the abs() error, the line number looks wrong. The math_functions.h header is no longer compatible with VS2010, something is going to have to give. Review the need to still have to #include math.h, it ought to be functionally replaced by Cuda. Hacking the header would be another way to get past the problem until they fix it:

#if !defined(_MSC_VER) || _MSC_VER < 0x1400
    // hypotf definition here...
#endif


来源:https://stackoverflow.com/questions/3685773/vs2010-compiler-and-cuda-error-linkage-specification-is-incompatible-with-previ

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!