Error when compiling a solution in c++ in visual studio 2017

Asked

Viewed 141 times

0

I’m trying to compile a c++ solution, but it’s not working. Can someone help me?

I opened a visual studio 2008 solution in visual studio 2017. When I give the build the error happens. I did not find in the project where it is included these headers (float.h and corecrt_math.h). Someone had a similar problem?

I’m using Windows SDK 10.0.17763.0 and Visual Studio 2017.

Error:

c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\float.h(311): error C2556: 'double _logb(double)': overloaded function differs only by return type from 'int _logb(double)'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\corecrt_math.h(512): note: see declaration of '_logb'
c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\float.h(311): error C2371: '_logb': redefinition; different basic types
c:\program files (x86)\windows kits\10\include\10.0.17763.0\ucrt\corecrt_math.h(512): note: see declaration of '_logb'

corecrt_math. h:

_Check_return_ _ACRTIMP int       __cdecl ilogb(_In_ double _X);

float. h:

_Check_return_ _ACRTIMP double __cdecl _logb(_In_ double _X);
  • rewrites your question in English... pt.stack.overflow.com only accepts questions in English

1 answer

0


In C++ it is illegal to overload two functions that differ only by type of return.

_Check_return_ _ACRTIMP int    __cdecl ilogb(_In_ double _X);
_Check_return_ _ACRTIMP double __cdecl _logb(_In_ double _X);

The first thing to do is remove include "corecrt_math. h" which seems to be an internal Microsoft C++ include, and see if the project builds.

If this doesn’t work, you’ll have to figure out which fonts depend on this include "corecrt_math. h", and do the compilation apart from these fonts.

  • I started commenting on #includes one by one and compiling the file, until I found the headers that were generating the problem. The hard part is finding the header since I was not explicitly including float. h e corecrt_math.h. As you said it must be something internal from Microsoft C++ .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.