fatal error CVT1100: duplicate resource. type:ICON, name:1, langua

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Danny Pressley

    fatal error CVT1100: duplicate resource. type:ICON, name:1, langua

    I have a VS.NET 2003 Visual C++ MFC Application Project in which I added a
    new resource file, I then added an icon to this new resource file and did a
    rebuild and got the following error: "fatal error CVT1100: duplicate
    resource. type:ICON, name:1, language:0x0409 ". But the resource ID is unique
    and only located in the new Resource1.h and
    MyResourceFile. rc files. Any ideas why this error is occuring?

    To generate the issue real quick, you can do the following:
    1) Create a test Visual C++ MFC Application Project with the default
    configuration settings.
    2) On the main menu, go to Project\Add New Item, then select Resource File
    (.rc), name it something like MyResourceFile.
    3) A file named Resource1.h is automatically created as the associated
    header to MyResourceFile. rc, open this file and change
    _APS_NEXT_RESOU RCE_VALUE 101 value to 1001 to make any new resource ID's
    unique.
    3) In the Resource View, add an icon resource to MyResourceFile and just
    save the blank icon.
    4) Now rebuild the project and BOOM.

    Thanks for any input,
    Danny Pressley

  • Gary Chang[MSFT]

    #2
    RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, langua

    Hi Denny,
    [color=blue]
    >..., Any ideas why this error is occuring?
    >
    >To generate the issue real quick, you can do the following:
    >...[/color]

    I am unable to repro that fatal error with the above repro steps unless I
    insert a new icon resource in the original resource file(AppName.rc ), so
    the exact problem here is that you have mutilple .rc files in your project
    and each has a same type resource(note, I mean the same type resource, not
    the same resource ID, in your case it is the icon type resource).

    This could be verified this by removing the icon resource in one of your
    rc files and inserting a new version resource to your second .rc file,
    then you will get the same error with the duplicate resource. type:VERSION).

    So while including mutilple resource files in the project, it is better to
    avoid inserting a certain type of resource into more than one resource
    files.


    Thanks!

    Best regards,

    Gary Chang
    Microsoft Community Support
    --------------------
    Get Secure! ¡§C www.microsoft.com/security
    Register to Access MSDN Managed Newsgroups!

    &SD=msdn

    This posting is provided "AS IS" with no warranties, and confers no rights.

    Comment

    • Danny Pressley

      #3
      RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, la

      Hi Gary,
      [color=blue]
      > So while including mutilple resource files in the project, it is better to
      > avoid inserting a certain type of resource into more than one resource
      > files.[/color]

      I also have the same issue with a version block and string table. I just
      mentioned only the icon in my explanation.

      This is very puzzling why this is not possible with only some of the
      resource types and not all. So to me this seems to be a bug in the Visual C++
      compiler.

      I have searched and searched the documentation and cannot find any
      description of this not being supported. Would you please point me to the
      documentation on why this is not allowed?

      Regards,
      Danny

      P.S. here is the exact steps I use to generate a test app to generate the bug
      1) Use VS.NET 2003
      2) Create a new project: File\New Project\Visual C++ Projects\MFC\MF C
      Application
      3) Name the project Test1 and press "Ok"
      4) When the app wizard pops up just press "Finish"
      5) Create a new resource file: Projects\Add New Item\Visual C++\Resource
      File (.rc)
      6) Name the resource MyResourceFile and press "Open"
      7) Go to the Solution Explorer and open Resource1.h
      8) Change the values 101 to 1001, 40001 to 50001, 1001 to 10001, and 101 to
      1001
      9) Save the changes in Resource1.h
      10) Go to the Resource View and highlight MyResourceFile. rc
      11) Right click and select "Add Resource" and add an icon
      12) Rebuild the project and BOOM


      Comment

      • Gary Chang[MSFT]

        #4
        RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, la

        >I have searched and searched the documentation and cannot find any[color=blue]
        >description of this not being supported. Would you please point me to the
        >documentatio n on why this is not allowed?[/color]

        yes Denny, there is no public documentation about this problem, I have also
        consulted it with our product development guys to confirm this issue, I
        will update when I got any results.


        Thanks for your understanding!

        Best regards,

        Gary Chang
        Microsoft Community Support
        --------------------
        Get Secure! ¡§C www.microsoft.com/security
        Register to Access MSDN Managed Newsgroups!

        &SD=msdn

        This posting is provided "AS IS" with no warranties, and confers no rights.

        Comment

        • Danny Pressley

          #5
          RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, la

          > yes Denny, there is no public documentation about this problem, I have also[color=blue]
          > consulted it with our product development guys to confirm this issue, I
          > will update when I got any results.[/color]

          Thanks Gary. I hope you find out something soon, as I am getting close to
          having to make a descision on the development path for the product. My goal
          was to have independent modules that consist of a view/frame/doc with each
          module having its own resource file that contains the modules respective
          icon, menu, toolbar, and ... .

          Best Regards,
          Danny

          Comment

          • Gary Chang[MSFT]

            #6
            RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, la

            Hi Deeny,

            I got it, we will update you as soon as possible.


            Thanks for your understanding!

            Best regards,

            Gary Chang
            Microsoft Community Support
            --------------------
            Get Secure! ¡§C www.microsoft.com/security
            Register to Access MSDN Managed Newsgroups!

            &SD=msdn

            This posting is provided "AS IS" with no warranties, and confers no rights.

            Comment

            • Gary Chang[MSFT]

              #7
              RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, la

              Hi Danny,

              Sorry for the late response, these days we are contacting our product
              develop team to investigate this issue, it appear such behavior is by
              design in our VS.NET's resource compiler, now they are looking for some
              workarounds on this problem, I will reply you with more information in a
              few days.

              Thanks for your patience!

              Best regards,

              Gary Chang
              Microsoft Community Support
              --------------------
              Get Secure! ¡§C www.microsoft.com/security
              Register to Access MSDN Managed Newsgroups!

              &SD=msdn

              This posting is provided "AS IS" with no warranties, and confers no rights.

              Comment

              • Gary Chang[MSFT]

                #8
                RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, la

                Hi Danny,

                Now I got the confirmation from our product team, this is really a resource
                compiler/OS limitation. Currently the linker doesn't support multiple rc
                files - and for the icon resource specificly, it should be because of an
                RT_GROUP_ICON created for each icon and these conflict across multiple rc
                files.
                [color=blue]
                >..., My goal was to have independent modules that consist of
                > a view/frame/doc with each module having its own resource
                >file that contains the modules respective icon, menu, toolbar, and ...
                >[/color]

                So with current VC resource compiler, I am afraid there is no way to do
                this, but our product team members will fix it in the future. We are
                looking at continual improvement, and it's this kind of feedback that let's
                us know what things you're trying to do, that we haven't yet exposed for
                you.

                Thanks for your understanding and patience!


                Best regards,

                Gary Chang
                Microsoft Community Support
                --------------------
                Get Secure! ¡§C www.microsoft.com/security
                Register to Access MSDN Managed Newsgroups!

                &SD=msdn

                This posting is provided "AS IS" with no warranties, and confers no rights.

                Comment

                • Danny Pressley

                  #9
                  RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, la

                  Bummer! Didn't want to hear that. It was going to be a very clean way to
                  isolate a doc/view/frame module for plug and play into an MDI framework app.

                  So I take it the engineers did not have any suggestions for a work around?

                  Regards,
                  Danny

                  Comment

                  • Gary Chang[MSFT]

                    #10
                    RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, la

                    Hi Danny,

                    Thanks for coming back to this issue!

                    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
                    --------------------
                    Get Secure! ¡§C www.microsoft.com/security
                    Register to Access MSDN Managed Newsgroups!

                    &SD=msdn

                    This posting is provided "AS IS" with no warranties, and confers no rights.

                    Comment

                    • Danny Pressley

                      #11
                      RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, la

                      Thanks for the in-depth description Gary. Yes fixing this issue in the future
                      would be beneficial. Seems like the only need is to add a new tag that can be
                      used in the projects main .rc file that identifies the ICON group (or other
                      resource types) as the primary set, that way the resource compiler will know
                      which resources are for the apps default set and just append any other
                      resources from other resource files to the directory.

                      I found a simply work around for now. Please let me know if you or the
                      development team see an issue with doing this because in my opinion its just
                      tricking the resource compiler into doing what I want. It seems to work just
                      fine, but I am worried that something may bite me in the behind sometime down
                      the road when I least expect it (like VC8 or ...).

                      1) Go to Solution Explorer.
                      2) Right click MyResourceFile. rc and select Properties.
                      3) Change "Exclude From Build" to Yes.
                      4) Open your projects .rc2 file for text editing.
                      5) Add #include "..\MyResourceF ile.rc".
                      6) Rebuild all and now things work (or seem to).

                      I am able to use the icon's in the second resource file now
                      (MyResourceFile .rc). But as I stated, I am worried since normally VC doesn't
                      allow two resource files with icons in each to compile legally.

                      My next step is to try some tests to move the second resource file to a DLL
                      along with the source for the doc/view/frame and dynamically at runtime,
                      actually load the doc/view/frame and its associated resources (icon, menu,
                      toolbars, formview, ...). If you or the development team have any opinion on
                      doing this, I would like to hear them, otherwse, wish me luck.

                      Regards,
                      Danny

                      Comment

                      • Gary Chang[MSFT]

                        #12
                        RE: fatal error CVT1100: duplicate resource. type:ICON, name:1, la

                        Hi Danny,

                        Glad to see you're making progress!
                        [color=blue]
                        >1) Go to Solution Explorer.
                        >2) Right click MyResourceFile. rc and select Properties.
                        >3) Change "Exclude From Build" to Yes.
                        >4) Open your projects .rc2 file for text editing.
                        >5) Add #include "..\MyResourceF ile.rc".
                        >6) Rebuild all and now things work (or seem to).
                        >
                        >I am able to use the icon's in the second resource file now
                        >(MyResourceFil e.rc). But as I stated, I am worried since normally VC[/color]
                        doesn't[color=blue]
                        >allow two resource files with icons in each to compile legally.[/color]

                        From the workaround above, I think you don't need to worry about it--- you
                        just inclde/merge your second resource file into your project's original
                        resouce file, so in this scenario, your project only has the original
                        resouce file to compile.

                        [color=blue]
                        >My next step is to try some tests to move the second resource file to a[/color]
                        DLL[color=blue]
                        >along with the source for the doc/view/frame and dynamically at runtime,
                        >actually load the doc/view/frame and its associated resources (icon, menu,
                        >toolbars, formview, ...).[/color]

                        It would be OK, you can create a resouce-only DLL to add your second
                        resource file, and the application could call LoadLibrary to explicitly
                        link to that DLL. Then the application would call the generic functions
                        FindResource and LoadResource to access the resources at run-time, please
                        refer to the following MSDN doc for more detailed info:

                        Create a Resource-Only DLL

                        ML/_core_create_a_ resource.2d.onl y_dll.asp

                        I hope the above information helps, if you have any questions or concerns,
                        please do not hesitate to let me know. I am standing by to help you.


                        Thanks!

                        Best regards,

                        Gary Chang
                        Microsoft Community Support
                        --------------------
                        Get Secure! ¡§C www.microsoft.com/security
                        Register to Access MSDN Managed Newsgroups!

                        &SD=msdn

                        This posting is provided "AS IS" with no warranties, and confers no rights.

                        Comment

                        Working...