delphicompiler-warningscompiler-directives

{$WARN DUPLICATE_CTOR_DTOR OFF} gets deleted from Dpk file


I need to turn off this compiler warning because I don't intend to make my library compatible with C++.

If I put the compiler directive in the PAS file that generates the warning, it is ignored.
If you put in in DPK files, the IDE will delete it every time I change the Project Options (we all know that at when changing the options, the DPK file gets partially rebuilt).

Question: How do I make the directive stay in the DPK file?

To reproduce it:


Solution

  • Go to Project>Options>Building>Delphi Compiler>Hints and Warnings, select the platform and configuration, then set that warning to False. And Save. (Depending on your version of Delphi, the exact location of this setting might be different.) Screenshot of warning setting