19
votes

Get the following error while linking my project in Delphi XE2. Recreating of .dproj file doesn't help.

[DCC Hint] H2161 Warning: Duplicate resource: Type 24 (user-defined), ID 1; File resource <filename>.res kept; file c:\program files\embarcadero\rad studio\9.0\lib\Win32\release\WindowsXP.res resource discarded.

How to fix it? Thanks for the help!

4
Just a note: I have noticed that from at least D2010 up (possibly D2009 up), the IDE cache sometimes gets in the way and you can get duplicate resource warnings on compiles. Do a build and they are gone. So nowadays whenever I see a duplicate resource warning, I first do a build and only start hunting if that doesn't clear it.Marjan Venema

4 Answers

21
votes

You've got more than one application manifest linked to the application. There can be only one and so some have to be discarded. Modern Delphi versions link a manifest by default based on the "Runtime themes" project option. You possibly have another manifest linked, perhaps dating from when you developed the project in an earlier version of Delphi. Are you using the TXPManifest component by any chance?

You can remove the manifest that you are explicitly linking. Or you can disable the runtime themes setting and retain the explicit manifest. That latter way you are in control of the manifest. Personally that is the way I do it because I do need to have control over precisely what goes in the manifest.

7
votes

I had the same problem, and arrived on this page via Google.

Removing XPMan from the uses-clause fixed it.

Found the culprit via "find in files" with search term "xpman". Thanks for Rob Kennedy for suggesting this in the comment to David's answer.

5
votes

Thanks for your help. For me, the following has helped:

{$ R * .RES} from project source removed
-1
votes

Removing {$R *.res} from project source helps. {$R *.res} is restricted in Delphi XE2?