如何修复这个delphi 7编译错误—“复制资源(s)”

时间:2021-08-14 17:07:44

I'm trying to compile a Delphi 7 project that I've inherited, and I'm getting this error:

我正在编译一个我继承的Delphi 7项目,我得到了这个错误:

[Error] WARNING. Duplicate resource(s):
[Error] Type 2 (BITMAP), ID EDIT:
[Error] File C:[path shortened]\common\CRGrid.res resource kept; file c:\common\raptree.RES resource discarded.

(错误)的警告。重复资源:[错误]2型(位图),ID编辑:[错误]文件C:[路径缩短]\公用\CRGrid。res资源保存;文件c:\ \ raptree。RES资源丢弃。

It says warning, but it's actually an error - compilation does not complete.

它说警告,但实际上是一个错误——编译不完整。

It looks like two components - CRGrid and RapTree - are colliding somehow. Does anyone have any ideas on how to fix this?

看起来有两个组件——CRGrid和RapTree——以某种方式发生了碰撞。有人知道如何解决这个问题吗?

Other than removing one of components from the project, of course.

当然,除了从项目中删除一个组件之外。

4 个解决方案

#1


3  

Try firing up your resource editor (I'm pretty sure Delphi comes with one) and open the files. Check what bitmap resources are in the two, see which can be the duplicate.

尝试启动资源编辑器(我确信Delphi附带了一个)并打开文件。检查这两个中的位图资源,看看哪个可以是副本。

If you need to keep both resources, you need to renumber one of them.

如果需要保留这两个资源,则需要重新编号其中一个。

#2


3  

try this: Fixing the "Duplicate resource" error

试试这个:修复“重复资源”错误

#3


1  

You'll need to go into the components and rename one of the resources and then update the component code to use the new name. It's a pain, but that's all you can do.

您需要进入组件并重命名其中一个资源,然后更新组件代码以使用新名称。这很痛苦,但这就是你能做的。

#4


1  

I know this is an old thread, but still worth an update for anyone maintaining old code:

我知道这是一个旧的线程,但是对于任何维护旧代码的人来说仍然值得更新:

I had this problem and it was due to images in RES files being named the same thing. Delphi7 has an Image Editor which can open RES files. Simply open both RES files involved in the Duplicate Resource error, and rename one of the offending duplicate resources. Save the RES files and recompile. Has worked for me twice recently when I replaced an old component in a Delphi 7 app with a (slightly) newer one.

我遇到了这个问题,这是由于RES文件中的图像被命名为相同的东西。Delphi7有一个可以打开RES文件的图像编辑器。只需打开包含在重复资源错误中的两个RES文件,并重命名一个违规的重复资源。保存RES文件并重新编译。最近,当我用一个(稍微更新的)新组件替换了Delphi 7应用程序中的一个旧组件时,我为自己工作了两次。

#1


3  

Try firing up your resource editor (I'm pretty sure Delphi comes with one) and open the files. Check what bitmap resources are in the two, see which can be the duplicate.

尝试启动资源编辑器(我确信Delphi附带了一个)并打开文件。检查这两个中的位图资源,看看哪个可以是副本。

If you need to keep both resources, you need to renumber one of them.

如果需要保留这两个资源,则需要重新编号其中一个。

#2


3  

try this: Fixing the "Duplicate resource" error

试试这个:修复“重复资源”错误

#3


1  

You'll need to go into the components and rename one of the resources and then update the component code to use the new name. It's a pain, but that's all you can do.

您需要进入组件并重命名其中一个资源,然后更新组件代码以使用新名称。这很痛苦,但这就是你能做的。

#4


1  

I know this is an old thread, but still worth an update for anyone maintaining old code:

我知道这是一个旧的线程,但是对于任何维护旧代码的人来说仍然值得更新:

I had this problem and it was due to images in RES files being named the same thing. Delphi7 has an Image Editor which can open RES files. Simply open both RES files involved in the Duplicate Resource error, and rename one of the offending duplicate resources. Save the RES files and recompile. Has worked for me twice recently when I replaced an old component in a Delphi 7 app with a (slightly) newer one.

我遇到了这个问题,这是由于RES文件中的图像被命名为相同的东西。Delphi7有一个可以打开RES文件的图像编辑器。只需打开包含在重复资源错误中的两个RES文件,并重命名一个违规的重复资源。保存RES文件并重新编译。最近,当我用一个(稍微更新的)新组件替换了Delphi 7应用程序中的一个旧组件时,我为自己工作了两次。