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.
People on the mighty internet say that {$WARN DUPLICATE_CTOR_DTOR OFF} should be placed in the DPR file. It works. But 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:
- Start Delphi 10.4,
- start a new Delphi package (File main menu)
- add {$WARN DUPLICATE_CTOR_DTOR OFF} after {$IMPLICITBUILD ON}.
- now open Project Options, change something and close the dialog. The directive will be gone.
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.)