views:

102

answers:

1

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  A: 

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
Hans Passant