Alex Rivera | Logout

How to resolve CVT1100 in Visual Studio 2010 Ultimate?

Asked 2010-08-04T07:16:52.470
22

I'm working on a medium-sized project which uses qmake to generate Visual Studio 2005 project files. I'm trying to get it built under Visual Studio 2010 Ultimate. Since qmake doesn't support this IDE yet i had the provided conversion assistant convert my solution.

When trying to build I get the following error in one of the subprojects:

CVTRES : fatal error CVT1100: duplicate resource. type:VERSION,name:1,language:0x0407

After what Google's results told me it seems that this error is likely to occur when migrating to a newer version of Visual Studio but I don't know why and the hacks recommended there don't work for me.

What I already tried is to rename the ressources to random numbers, even a different "name" at every occurence of the version information. When I build the project again after reading the error and deleting the corresponding .RC-file it works once. But that's too much of a hack.

Any ideas anyone? Thanks in advance.

Edit
Report

2 Answers

14

I recently solved the similar problem with Qt 4.8.2 and Visual Studio 2012. Qt 4.8.2 does not support VS2012 as mkspec, so I copied win32-msvc2010 mkspec to win32-msvc2012 (changing _MSC_VER to 1700) and used some other workarounds (QtWebKit fix, etc. — you can find them over the internet) to build Qt 4.8.2 with VS2012. But qmake was not aware of VS2012 .vcxproj project files, so it continued to generate VS2010 projects. After conversion of these project files to the new 2012 format in the VS the above error arose.

The solution was to exclude generated .res files from build in all configurations (both Debug and Release). To do this, open 'Generated Files' folder in Solution Explorer, right click the .res file, open Properties, select 'All Configurations' from drop-down list and set 'Excluded From Build' property of 'General' section to 'Yes'.

It is quite tedious to repeat these actions by hands every time, so I wrote Python script to automate this. You can use it (at your own risk!) to update qmake-generated .vcxproj files.

    import sys
    import os
    from xml.etree import ElementTree

    def updateProject(filename):

        def getXmlns(tag):
            return tag[1:].split('}')[0]

        tree = ElementTree.parse(filename)
        root = tree.getroot()
        xmlns = getXmlns(root.tag)
        for cb in root.iter('{' + xmlns + '}CustomBuild'):
            if(not 'Include' in cb.attrib):
                continue
            if(not cb.attrib['Include'].endswith('.res')):
                continue
            for excl in cb.iter('{' + xmlns + '}ExcludedFromBuild'):
                if('Condition' in excl.attrib):
                    del excl.attrib['Condition'] # delete ExcludedFromBuild condition
        ElementTree.register_namespace('', xmlns)
        tree.write(filename)

    if(len(sys.argv)>=2): # use project files sp
answered 2012-09-16T10:21:38.313
2

This is a stretch, but I had a similar problem under Visual Studio 2005. It might help, or be totally off base:

I was linking with a static library (.lib) that has its own version resource - very reasonable, it shows the library's version. On some stations, my app would link. On other stations, I'd get the same duplicate resource message you got.

It turned out to be related to a linker optimization setting: "Use Library Dependency Inputs" (UseLibraryDependencyInputs=), possibly combined with "Link Library Dependencies". When "Use Library Dependency Inputs" was enabled, the linker was being fed the .obj and .res files that were used to build the .lib, instead of just searching the .lib.

The problem is that you don't want the .lib's .res file as an input file to the linker. My project has its own version resource. If you bring in the .lib's resources, you now have two version resources, hence the error. If the linker simply searches the .lib, it has no reason to bring in the .lib's resource, and all is well.

My project's configuration didn't force the setting of "Use Library Dependency Inputs", it inherited it. On some stations, it inherited "No", and I could link. On some stations, it inherited "Yes", and we got the error.

If Visual Studio 2010 still has this setting, try forcing it off.

answered 2010-08-04T18:08:31.417

Your Answer