gpt4 book ai didi

c++ - fatal error CVT1100 : duplicate resource. 类型 :ICON, 名称 :1 (C++, Visual Studio C++ 2010)

转载 作者:太空狗 更新时间:2023-10-29 21:17:55 30 4
gpt4 key购买 nike

我尝试向项目添加自定义图标(13x13 尺寸)。

我找不到为什么我无法加载图标。

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

来自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

通用.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

文件2.rc:

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






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

我尝试更改 IDI_TERRAIN 和其他图标的 ID,但没有帮助。

据此: https://msdn.microsoft.com/en-us/library/b1kw34cb%28v=vs.80%29.aspx我试过换号码,没用

请注意,如果我注释掉有问题的行,则会加载 IDI_LOGO。有帮助吗?

错误在resource.hVisual Studio C++ 2010, Windows XP

最佳答案

我遇到了同样的问题。看起来不可能合并.rc。文件,如果它们都有图标。尽管您可能拥有非重叠编号方案。

请参阅以下 Microsoft 的解释:Gary Chang 已发布此 interesting explanation网络上的其他地方:

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

关于c++ - fatal error CVT1100 : duplicate resource. 类型 :ICON, 名称 :1 (C++, Visual Studio C++ 2010),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31323596/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com