Microsoft KB Archive/320216

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

Article ID: 320216

Article Last Modified on 4/11/2003

-

APPLIES TO


 * Microsoft Visual C++ .NET 2002 Standard Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition

-



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:

&quot;Resource data is invalid.

unable to save resource script.&quot;

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:

&quot;fatal error CVT1100: duplicate resource. type:STRING, name:7, language:0x0409&quot;

&quot;fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt&quot;



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.



Steps to Reproduce the Behavior
 Create a new MFC application in Visual Studio .NET. Add an additional resource file to your MFC project. To add a resource file, follow these steps:  Select your existing project folder in Solution Explorer, for example, . On the Project menu, click Add New Item. In the Add New Item dialog box, click the Visual C++ folder, and then click Resource File (.rc) in the right pane.</li> Type a name for your resource script file in the Name box, and then click Open.</li></ol> </li> 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.</li> Build the project or try to save the resource file.</li> 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.</li></ol>

Keywords: kbbug kbpending KB320216

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.