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.

14 Answers 14

22

I resolved that problem when moving from VC++ 2010 to 2012 by changing the setting under Configuration Properties>Manifest Tool>Input and Output>Embed Manifest to NO. I have no idea what that is all about, but I looked at the contents of the .manifest file, and it sure looks like I can live without it being embedded.

3
  • 1
    I had this issue when project was migrated from older VS
    – mlt
    Jan 31, 2014 at 20:40
  • 9
    This answer is wrong, but no point in creating a new answer since this already has upvotes. You are getting a "duplicate" error because VS is generating its own manifest, and then you have ALSO specified your own manifest under Manifest Tool>Input and Output>Additional Manifest Files. And Embed Manifest to "No" means you don't have a manifest file. The correct solution is leave that as "Yes" to embed your custom additional manifest file, but instead tell VS not to create its own manifest. You'll find that property under Linker>Manifest File>Generate Manifest and set that to "No"
    – mikew
    Dec 27, 2016 at 18:20
  • Had a similar issue with migrating a VS6 project to VS2005: CVTRES : fatal error CVT1100: duplicate resource. type:MANIFEST, name:1, language:0x0409. Setting Manifest Tool>Input and Output>Embed Manifest to NO fixed it, whereas Linker > Manifest File > Generate Manifest setting doesn't change the error. May 16, 2017 at 10:58
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 specified in command line:
        for i in range(1, len(sys.argv)):
            updateProject(sys.argv[i])
    else: # update all project files in current directory:
        for filename in os.listdir(os.getcwd()):
            if(filename.endswith('.vcxproj')):
                updateProject(filename)

Thanks to Xandy for pointing out that you'll need to pass working directory to listdir() for script to work in Python 2.

2
  • Thank you, I just came across a similar situation and that Python script was most useful. I had to modify the call to listdir() using os.getcwd() as its parameter to make it work in my machine (Python 2.7.3).
    – Xandy
    Oct 27, 2012 at 20:10
  • This solution worked for me for Qt 4.8.5 and VS 2013.
    – JPaget
    Nov 12, 2013 at 18:56
6

If you ever encounter this error while compiling (usually a downloaded project from internet), then remove the manifest file and remove the reference to the manifest file in the .rc file.

Reference

2
  • 1
    On the other hand, I have no manifest file in project, I tried to disable embed manifest and I still have this error (but I am user of Visual Studio C++ 2010 (no updates on VS or VS Service Packs)).
    – John Boe
    Jul 9, 2015 at 18:53
  • 1
    +1 for getting me on the right track. For me, I had to remove the *.rcv file which which held duplicate resource definitions. Then I had to remove the references to it in the *.rc file. Everything compiled fine after that without changing any linker settings.
    – cory.todd
    Aug 13, 2015 at 16:57
4

I recently ran into this problem, and by accident ended up with a project file that didn't have the resource conflict. In my case I was importing a QT qmake generated project for VS2008 into VS2010. After using VcprojFormatter and a lot of diffs, I found the difference (for me). I think it is a bug in either the import wizard, or the core of VS 2010.

http://www.codeproject.com/KB/macros/vcproj_formatter.aspx

My resource file was called win32_resources.rc You'll need to edit each intermediate data folder corresponding to your build configurations (release, debug, etc)

Look for a section like the following in your vcxproj file:

<ItemGroup>
  <Resource Include="debug\win32_resources.res">
    <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
  </Resource>
  <Resource Include="release\win32_resources.res">
    <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
  </Resource>
</ItemGroup>

All the "Resource" text should be replaced with "CustomBuildStep":

<ItemGroup>
  <CustomBuildStep Include="debug\win32_resources.res">
    <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
  </CustomBuildStep>
  <CustomBuildStep Include="release\win32_resources.res">
    <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
  </CustomBuildStep>
</ItemGroup>

The problem in the VS2008 file is that the default(?) setting was not explicit:

<File RelativePath="release\win32_resources.res">
  <FileConfiguration
    Name="Debug|Win32"
    ExcludedFromBuild="true"
    >
    <Tool Name="VCCustomBuildTool"/>
  </FileConfiguration>
</File>

The "Tool Name" field was missing.

0
3

If you ever encounter this error while compiling (usually a downloaded project from internet), then remove the manifest file and remove the reference to the manifest file in the .rc file.

This answer by hB0 was 100% correct for the case I encountered.

This was very useful to me and I would like others to benefit from knowing this, rather than assuming hB0's answer should be ignored because others have votes and hB0's has zero votes. I have to say it in a separate answer because I the system will not let an unregistered user vote. I even registered so as to be able to vote on this answer but the system still will not let me vote till I am a more mature user.

0
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.

2
  • Makes sense, but playing with these settings doesn't change anything about my error.
    – user410436
    Aug 12, 2010 at 20:11
  • This fixed the problem I was seeing in VS2005!
    – Erik
    Jun 23, 2011 at 5:16
2

I had this problem and it was resolved by ensuring any included .rc files were excluded from the build, except the main .rc that was #including the rest.

1

I had this problem and it was resolved by ensuring any included .rc files were excluded from the build, except the main .rc that was #including the rest. by Richard Hein worked for me. I was compiling with VS2013.

0
1

I had similar problem in Visual Studio C++ 2010. I did not installed any Service packs or updates of VS and this problem arises when I had two rc files which tried to use ICONs. So I just taken content of one file and cut it into the main file. So only one file contains the ICONS and the second file is empty. Works like sharm :-).

0
0

Replace else block in Dmitry Markin answer to recursively update all project files

else: # recursively update all project files in current directory:
    rootdir = os.getcwd()
    for root, subFolders, files in os.walk(rootdir):        
        for filename in files:
            if(filename.endswith('.vcxproj')):
                filePath = os.path.join(root, filename)
                print "file: %s" % (filePath)
                updateProject(filePath)
0

I came here looking for an answer for this error. I am sorry to burst the bubble. None of the answers worked out for me. My mistake was I had defined 3 MACRO's with same id. That is the reason I was getting the error mentioned in the question.

my code before when the error was showing:

#define IDB_MARKER_NORMAL_LINE          21**6**   
#define IDB_MARKER_ARROW_LINE           21**6**   
#define IDB_MARKER_DOTTED_LINE          21**6**  

i changed it to:

#define IDB_MARKER_NORMAL_LINE          21**6**   
#define IDB_MARKER_ARROW_LINE           21**7**   
#define IDB_MARKER_DOTTED_LINE          21**8**  

Errors were GONE!!!!!!!!!!

0

I had this and I did the following in resource.h

#undef VS_VERSION_INFO
#define VS_VERSION_INFO                 310

As VS_VERSION_INFO is given resource id 1 in WinRes.h just making it something else fixed my issue.

0

If you ever encounter this error while compiling (usually a downloaded project from internet), then remove the manifest file and remove the reference to the manifest file in the .rc file.

This answer by hB0 was 100% correct for the case I encountered.

This was very useful to me and I would like others to benefit from knowing this, rather than assuming hB0's answer should be ignored because others have votes and hB0's has zero votes. I have to say it in a separate answer because I the system will not let an unregistered user vote. I even registered so as to be able to vote on this answer but the system still will not let me vote till I am a more mature user.

This answer point a way to find the problem that I encounted. In my senario, the import props has this code:

<ResourceCompile Include="$(VersioningDir)**Version.rc" />

When I delete it, all work is done.

0

If you ever encounters CVT1100 (duplicate resource) & LNK1123 (failure during conversion to COFF) resource errors in Visual Studio 20XX, then do below steps to resolve it.

  1. Open .rc file & comment / remove below MACRO

    MOVEABLE PURE "res\.manifest"

2 Rename / Delete Manifest file from Resource folder from Project directory.

Now Re-build the solution & Enjoy...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.