John Boe
John Boe

Reputation: 3611

fatal error CVT1100: duplicate resource. type:ICON, name:1 (C++, Visual Studio C++ 2010)

I tried to add custom icons (13x13 dimention) to a project.

I cannot find why I cannot load icon.

CVTRES : fatal error CVT1100: duplicate resource. type:ICON, name:1, language:0x0409 LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

Some information from resource.h:

#define IDI_LOGO   16   //0x10 - no problem here
...
/* Bitmaps */
#define IDB_LOGO            200
#define IDB_GOOD            201
#define IDB_EVIL            202

/* Icons */
#define IDI_TERRAIN 90 // problem starts here
#define IDI_ELEV    91
#define IDI_DRAWREPLACE 92
#define IDI_DRAWFILL    93
#define IDI_DRAWBRUSH   94

common.rc:

#include "resource.h"
/* Bitmaps */ // no problem
#define IDB_LOGO            200
#define IDB_GOOD            201
#define IDB_EVIL            202

/* Icons */ // problem:
#define IDI_TERRAIN 90
#define IDI_ELEV    91
#define IDI_DRAWREPLACE 92
#define IDI_DRAWFILL    93
#define IDI_DRAWBRUSH   94

file2.rc:

#include "resource.h"
IDI_LOGO    ICON    DISCARDABLE "res/swgbts.ico"






#include "resource.h"
IDI_LOGO    ICON    DISCARDABLE "res/aokts.ico"

I tried to change the id of the IDI_TERRAIN and other icons, did not help.

According this: https://msdn.microsoft.com/en-us/library/b1kw34cb%28v=vs.80%29.aspx I tried to change the number, did not help

Note that if I comment out the problematic lines, IDI_LOGO is loaded. Any help?

The error is in resource.h Visual Studio C++ 2010, Windows XP

Upvotes: 4

Views: 9570

Answers (4)

Zhang
Zhang

Reputation: 3346

For me, it just has duplicated resource IDs.

#define IDB_LOGO            200
...
#define IDB_EVIL            200

Changing one of them would resolve the problem.

Upvotes: 1

Sergey Majorov
Sergey Majorov

Reputation: 1

I had this problem in VC 2015 but at small changes error

2>CVTRES : fatal error CVT1100: duplicate resource. type:DIALOG, name:564, language:0x041B 2>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt

I'm having any *.rc files in *.vcxproj and my resource.h is:

#define IDC_1  100
#define IDR_1  101
//etc
//about 
#define IDXXX_XXX  12000
//and
#define ID_1 32769
//etc

I replaced defines from 100 to 999 after "IDXXX_XXX" renumber and rebuild. So problem is solved.

Upvotes: 0

E. van Putten
E. van Putten

Reputation: 673

I ran into the same issue. Looks like it is impossible to merge .rc. files if they both have icons. Despite the non-overlapping numbering scheme you might have.

See below explanation from Microsoft: Gary Chang has posted this interesting explanation elsewhere on the net:

The following is more detail info on the root cause of this problem: "Basically what's happening is that Icon resources are composed of two different Win32 resource types C RT_GROUP_ICON and RT_ICON. You can think of RT_GROUP_ICON as a directory of RT_ICON resources. The RT_ICON resources are the actual icon images.

The VC resource editor tries to simplify this for you in a single icon resource entity and under the hood handles some things like creation and ID naming of the individual RT_ICON resources (the #1 you're seeing in this case). The VC resource editor was also created back in the day when it was only possible to have a single .rc file in a given .exe or .dll. Changes have since been made in the command line tools to allow use of multiple .rc files to contribute to a given .exe or .dll but I don't believe the resource editor implementation was ever revisited with this new possibility in mind, at least from the standpoint of the way it handles icons.

So with the current VC++ compiler,the only thing that can be done in this case if you want to have multiple resource files is to keep all icon (and cursor) resources in a single .rc file. That will let the VC resource editor keep all the RT_ICON identifiers unique."

Wish this helps and thanks for your understanding! Best regards,

Gary Chang Microsoft Community Support

Upvotes: 5

John Boe
John Boe

Reputation: 3611

I Solved the problem.

I have moved content of one .rc file to main rc file. The compiler had problem to include ICONs from two resources. I have no idea why but this is clear and simple solution.

Upvotes: 3

Related Questions