C2572 in VS2019: Other CPP Headers & Modules

  • Thread starter Thread starter LaurieSt
  • Start date Start date
L

LaurieSt

Guest
Hi there,
My intention is to present this as more of a problem with design of code more than an explicit issue with Visual Studio or C++:


In Module A.h:

#include B.h // By design, unfortunately
void foo(int x=0);


In Module A.cpp

void foo(int x) {}

In Module B.h

void foo(int x=0); // C2572 redef of def. args

In Module B.cpp

int x = foo(y);

It’s gone from memory as to whether the redefinition was ever permitted in other modules in previous versions of Visual Studio- and so if it were just a VS2019 thing alone.

Is there any way to use the method of A in the B modules other than cloning the function in B with a new alias- thinking classes, but not sure of the right way to go about it.

Thanks for reading!


A natural, B flat, C sharp, D compile

Continue reading...
 
Back
Top