BUG: Cannot Build a Microsoft Foundation Classes Application After You Add a New Resource File That Contains a String Table (320216)



The information in this article applies to:

  • Microsoft Visual C++ .NET (2002)
  • Microsoft Visual C++ .NET (2003)

This article was previously published under Q320216

SYMPTOMS

In Visual C++ .NET, a Microsoft Foundation Classes (MFC) application can have multiple resource (.rc) files. However, when you add a new resource file that contains a string table, and then you try to build the project or save the resource file, you receive the following error message:
"Resource data is invalid.
unable to save resource script."
When you add new string entries in the string table of the new resource file and then try to build the project again, you may receive the following error messages:
"fatal error CVT1100: duplicate resource. type:STRING, name:7, language:0x0409"

"fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt"

CAUSE

The first error occurs because there is no string entry in the string table of the new resource file.

You may receive the second error message if the IDs in the string tables of the existing resource file and the new resource file conflict. When Resource Compiler compiles a string table, it reserves a group of 16 IDs. For example, if ID 100 is used in the string table of the first resource file and ID 110 is used in the string table of the second resource file, a conflict occurs.

RESOLUTION

To work around this problem, follow these steps:
  1. Add a string entry in the string table of the new resource file.
  2. To avoid conflicts, do not use string IDs that are too close to each other in different resource files of a MFC project. For example, if one resource file contains the string ID 100, do not use an ID value in the range 100 to 115 in other resource files of the same MFC project.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a new MFC application in Visual Studio .NET.
  2. Add an additional resource file to your MFC project. To add a resource file, follow these steps:
    1. Select your existing project folder in Solution Explorer, for example, MyProject.
    2. On the Project menu, click Add New Item.
    3. In the Add New Item dialog box, click the Visual C++ folder, and then click Resource File (.rc) in the right pane.
    4. Type a name for your resource script file in the Name box, and then click Open.
  3. In Resource View, right-click the new resource file, and then click Add Resource. In the Add Resource dialog box, click String Table, and then click New.
  4. Build the project or try to save the resource file.
  5. Add a new string entry in the new resource file that has the same ID as a string entry in the existing resource file, and then build the project.

Modification Type:MajorLast Reviewed:4/11/2003
Keywords:kbbug kbpending KB320216