awmross
awmross

Reputation: 3839

Duplicate resource warning from same file

I am getting this rather confusing compiler warning:

[DCC Warning] W1056 Warning: Duplicate resource: Type 14 (ICON GROUP), ID MAINICON; File C:\dev\dispense\trunk\dev\source\mountaintop\dispense\MtnDispense.res resource kept; file C:\dev\dispense\trunk\dev\source\mountaintop\dispense\MtnDispense.res resource discarded.

In case the formatting isn't clear; the two paths it mentions are identical.

The application doesn't have any entries under Project->Resources

The application has a custom icon, defined under Project->Options->Application->Icon.

Does this warning mean anything? And how can I remove it?

Upvotes: 15

Views: 17682

Answers (4)

IceCold
IceCold

Reputation: 21212

In my case the problem was like this:

Program xyz;
 
uses
  FastMM4,
  Windows,
  SysUtils,
  Forms,
  cIO,
  FormManager in 'FormManager.pas' {FrmManager} {$R *.RES}; <----- HERE

{$R *.RES}

The IDE corrupted the DPR file and accidentally added an extra $R directive in the 'uses'. Actually, this is not a "happen once" case. I see this from time to time.
This explains your:

No idea how that got there (accidental paste??).

Upvotes: 2

The name of application: Teste.dpr, name of resource rc : Teste.rc that generate Teste.res, the same name generated by Teste.dpr, this is the problem.

I rename Teste.dpr to UsandoRecurso.dpr then I can compile correctly.

Upvotes: -1

NGLN
NGLN

Reputation: 43669

I reproduced your problem:

program ProjectName;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1};

{$R *.res}
{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

Remove the second compiler directive. Or there is a {$R ProjectName.res} somewhere in another source file.

Upvotes: 8

crefird
crefird

Reputation: 1610

It means the resource file is being imported more than once. You should only have one

{$R *.res}

in your dpr file. To fix the error, remove the extra ones.

Upvotes: 33

Related Questions