The information in this article applies to:
SYMPTOMSAdding a string resource to an application that uses MFC as a static link library may result in the use of the same ID value twice in a STRINGTABLE statement. This problems results in the Resource Compiler generating the error RC2151 "Cannot re-use string constants," which is likely to happen when using the resource editor to add the string. CAUSE
When using MFC as a static library in an application, MFC's resources are
compiled into the .exe.
causes string resources defined in Afxres.h to be used in the application
when building Afxres.rc. If an ID value of another string resource matches
any of the ID values used in Afxres.rc, the same ID value is used twice in
a STRINGTABLE statement.NOTE: The problem is not multiple definitions of the ID symbol, but rather, the use of the definition multiple times in a string table. RESOLUTIONConsult both Technical Note 20 "ID Naming and Numbering Conventions" and the file Afxres.h to help locate ID values used by Windows or MFC. Then remove any entries in the string table that use ID values more than once (for example, an entry in the application's string table that has a ID value matching an ID value in Afxres.h). STATUSThis behavior is by design. MORE INFORMATIONTechnical Note 20 "ID Naming and Numbering Conventions" lists many of the ID ranges used for specific purposes. However, this article does not mention the possible conflict with the IDs defined in Afxres.h. Steps to Reproduce Behavior
This error is generated because AFX_IDS_UNNAMED_FILE is defined with the value of 0xF006 in Afxres.h and is used in both the Afxres.rc file and the application's .rc file. REFERENCESFor additional information, please see the following article(s) in the Microsoft Knowledge Base: Q21569 RW2002 Error "Cannot Reuse String Constants" in RC.EXE(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Isaac Varon, Microsoft Corporation Additional query words:
Keywords : kbMFC kbResourceEd kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 kbMFC600bug |
Last Reviewed: July 27, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |