Jump to content
Bill Meyer

Duplicate resource, but strange...

Recommended Posts

I have seen the basic message before, but this one leaves me scratching my head:

[DCC Error] E2161 Warning: Duplicate resource:  Type 14 (ICON GROUP), ID MAINICON; File D:\MyProj\MyProg.RES resource kept; file D:\MyProj\MyProg.RES resource discarded.

 

The file kept and the file discarded are the same file?

Share this post


Link to post

Look in your project source (the .dpr file)... do you have multiple {$R *.res} lines?

 

Share this post


Link to post
45 minutes ago, rvk said:

Look in your project source (the .dpr file)... do you have multiple {$R *.res} lines?

 

I don't recall this happening before, but I add a module to the project, and a {$R *.res} is added to the tail of a unit in the DPR. And it has happened now a few times. Hopefully, restarting the IDE will clear that mode.

Share this post


Link to post

Yes, that sometimes happens to me too.

Often this is due to the IDE not recognizing some lines and not knowing it already has a {$R *.res} line.

 

Sometimes reordering the uses-units and other elements will fix this (if it keeps happening).

(I had to move my {$R} lines above the uses- and {$SETPEFLAGS} lines.)

 

Share this post


Link to post

I've seen this show up in projects randomly then not stop, and have never figured out what causes it. But after reading this, I do recall something I saw years ago about how the position of the $R line can cause it. I think in our case, it may have been because of some merging of edited source files and it got put in the wrong place. Some people seem to think that its position is innocuous, but apparently it's not.

 

This is a great reminder. Thanks!

Edited by David Schwartz

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

×