问题描述
当我尝试在64位Windows 7上使用VS 2010在Debug 64位配置中构建我的项目时遇到此错误以及其他两个错误。
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.
错误:连接规范与math.h中之前的hypot不兼容第161行
错误:连接规范与math.h中之前的hypotf不兼容第161行
错误:functionabs(long long) 已经在math_functions.h line 534中定义了
error: linkage specification is incompatible with previous "hypot" in math.h line 161error: linkage specification is incompatible with previous "hypotf" in math.h line 161error: function "abs(long long)" has already been defined in math_functions.h line 534
我在32位构建中没有得到这些错误。此外,64位构建工作在VS2008。是否有正确的工作绕过这个问题,还是应该等到nvcc支持VS 2010编译器?
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?
推荐答案
更改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);
}
不确定abs()错误,行号看起来错误。 math_functions.h头不再与VS2010兼容,有些东西要给。检查需要仍然必须#include math.h,它应该被Cuda功能替换。黑客的标头将是另一种方式来解决问题,直到他们修复它:
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
这篇关于VS2010编译器和cuda错误:链接规范不兼容以前的“hypot”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!