Article ID: 194299 - Last Review: November 21, 2006 - Revision: 3.1 You receive an "RC2151 Cannot re-use string constants" error message when you try to add a string resource to an application in Visual C++This article was previously published under Q194299 On This PageSYMPTOMS Adding 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. The Resource Compiler generates the following
error: RC2151 Cannot re-use string constants
CAUSE When using MFC as a static library in an application, MFC's
resources are compiled into the .exe. The statement on line 26 of Afxres.rc #ifndef _AFXDLL NOTE: The problem is not multiple definitions of the ID symbol, but rather, the use of the definition multiple times in a string table. RESOLUTION Consult 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). STATUS This behavior is by design. MORE INFORMATION Technical 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
error RC2151 : cannot reuse string constants,
61446(0xF006) REFERENCES For
more information, click the following article number to view the article in the
Microsoft Knowledge Base: 21569
(http://support.microsoft.com/kb/21569/
)
RW2002 Error "Cannot Reuse String Constants" in RC.EXE
(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by
Isaac Varon, Microsoft Corporation
APPLIES TO
| Article Translations
|

Back to the top
