VisualStudio linking error when re-compiling

12 Feb

Well, I don’t want to lose to many words about VisualStudio compared to any professionally acting development tool, but there seem to be (non-)surprisingly many people out there suffering from the same insane problem…

When re-compiling a project, with the intention of only processing those files that have been changed since the last run (or those depending on such files), the linker fails in a miserable way:

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

As common when using tools from Redmond, the error message is of almost no real help, since it does not tell anything about the file(s) that caused this problem. BTW, you won’t find any more details in the oh-so-detailed build-log either…

Well, the relly bad problem here is the linker itself, who tries to incorporate a given icon file into the executable binary, and thus runs the visual studio resource compiler (“RC.EXE” iirc), which in turn terribly cries out noticing there is already a compiled resource file where it would like to create a new one so desperately… Having left you standing there in the rain, compilation fails. It doesn’t even consider to tell you which files conflict or simply override the old resource file.

To avoid this, navigate to the topmost folder in your destination tree, and look for files having a “.res“ suffix. Using a sane cygwin shell, simply do something like:

find | grep ".res$" | xargs rm -v

Having removed the .res-files, recompiling works like a charm. Well, I’m going home into the GNU-zoo now, enough of this annoyance…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: