3

当我尝试在调试 64 位配置中使用 VS 2010 在 64 位 Windows 7 上构建我的项目时,我收到此错误以及其他两个错误。

错误:链接规范与 math.h 第 161 行中先前的“hypot”不兼容错误:链接规范与 math.h 第 161 行中的先前“hypotf”不兼容错误:函数“abs(long long)”已在 math_functions 中定义.h 第 534 行

我在 32 位版本中没有收到这些错误。此外,64 位版本在 VS2008 中工作。这个问题是否有适当的解决方法,还是我应该等到 nvcc 支持 VS 2010 编译器?

4

1 回答 1

1

是的,这在 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 取代。破解标题将是解决问题的另一种方法,直到他们修复它:

#if !defined(_MSC_VER) || _MSC_VER < 0x1400
    // hypotf definition here...
#endif
于 2010-09-10T16:53:05.780 回答