Jump to content
Lars Fosdal

How do I suppress a Inaccessible from C++ warning?

Recommended Posts

[dcc32 Warning] W1029 Duplicate constructor 'MyClassName.ConstructorName' with identical parameters will be inacessible from C++
 

{$WARN DUPLICATE_CTOR_DTOR OFF}

does not seem to have any effect in Delphi 10.3.1
 

I know I can add an extra dummy parameter to change the signature - but shouldn't that $WARN thing have worked too?

Share this post


Link to post

Assuming that you don't need to use that code from C++Builder just turn off header generation.

 

image.thumb.png.702d14bc86c0698f1760049e5f7700ce.png

Edited by Stefan Glienke
  • Thanks 1

Share this post


Link to post

It may help to place that directive in the project file instead of the unit with the class declaration.

  • Like 1
  • Thanks 1

Share this post


Link to post
1 hour ago, Uwe Raabe said:

It may help to place that directive in the project file instead of the unit with the class declaration.

Yes, IIRC you're correct.  We had to (IIRC) use the .dproj file switch because for whatever reason (bug?) the compiler ignores the compiler directive but does respect the .dproj flag.  (To add, in our case the "C++ output file generation" was also already off, however the compiler still emits/emitted this warning from one of the Synopse modules e.g. SynCommons.pas: "'ESynException.CreateLastOSError' with identical parameters will be inaccessible from C++" (and checking the module was being recompiled from scratch.)  The only way that worked was the .dproj flag.  

  • Like 1

Share this post


Link to post

Project Options -> Delphi Compiler -> Hints and Warnings ->  Output warnings -> "Duplicate constructor/destructor with identical parameters will be inacessible from C++" -> False

 

did the trick.

(Note the typo in the IDE)

  • Like 1

Share this post


Link to post
Guest

Wow! +1 to Lars for asking the question that i should have asked for ages now.

+1 to ByteJuggler for presenting the exact "problem" i have and the solution.

I love this forum.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×