'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?
Solution 1:[1]
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.
Solution 2:[2]
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.
Solution 3:[3]
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??).
Solution 4:[4]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | crefird |
| Solution 2 | NGLN |
| Solution 3 | |
| Solution 4 | Marlon Leite de Albuquerque |
