Share via

cmath build errors with VS2019 C++

Barry Daniel 6 Reputation points
2022-07-27T12:24:20.553+00:00

I have some C++ code that I can build with VS2015 and VS2017 but not with VS2019. I am getting build errors with cmath. I did a compare between the cmath file in VS2017 (MSVC 14.16.27023) and the cmath file in VS2019 (MSVC 14.29.30133) and there are many differences. As an example:

VS2017 cmath:
_Check_return_ inline float acos(In float _Xx) noexcept
{
return (_CSTD acosf(_Xx));
}

VS2019 cmath:
_NODISCARD _Check_return_ inline float acos(In float _Xx) noexcept /* strengthened */ {
return _CSTD acosf(_Xx);
}

I am getting the following errors for this line:
C2589: '(': illegal todken on right side of '::'
C2062: type 'unknown-type' unexpected
C2059: syntax error: ')'

I am postulating that it may have something to do with the different parenthesis used between the two files. I also get this error for the asinf, atanf, atan2f, cosf, expf, fabsf, fmodf, logf, log10f, powf, sinf, sqrtf, and tanf.

Developer technologies | C++
Developer technologies | C++

A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.