Microsoft KB Archive/248094

= BUG: Fatal Error RC1022: Expected '#endif' or Error RC2104: Undefined Keyword or Key Name =

Article ID: 248094

Article Last Modified on 12/11/2003

-

APPLIES TO


 * Microsoft Visual C++ 5.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 5.0 Professional Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q248094



SYMPTOMS
When compiling a resource script that includes Chinese and Japanese resources in the compile-time directives, the following errors may occur:

\RCXXXXXX(YYYY) : fatal error RC1022: expected '#endif'

-or-

\ .rc (YYYY): error RC2104 : undefined keyword or key name

Where RCXXXXXX is a temporary file created by the resource compiler and YYYY is the line number.



CAUSE
The resource compiler, RC.exe, incorrectly preprocesses the resource script.



RESOLUTION
To resolve this problem, wrap the inclusion of the Japanese and Chinese scripts with the appropriate language statement.

If the resource script includes Chinese (Taiwan) resources: wrap the inclusion as follows: LANGUAGE 4, 1
 * 1) include .rc
 * 1) if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHT)
 * 2) ifdef _WIN32
 * 1) pragma code_page(950)
 * 2) endif //_WIN32
 * 3) include .rc
 * 4) endif

If the resource script contains Chinese (PRC) resources: wrap the inclusion as follows: LANGUAGE 4, 2
 * 1) include .rc
 * 1) if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
 * 2) ifdef _WIN32
 * 1) pragma code_page(936)
 * 2) endif //_WIN32
 * 3) include .rc
 * 4) endif

If the resource script includes Japanese resources: wrap the inclusion as follows: LANGUAGE 17, 1
 * 1) include .rc
 * 1) if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
 * 2) ifdef _WIN32
 * 1) pragma code_page(932)
 * 2) endif //_WIN32
 * 3) include .rc
 * 4) endif

If the resource script includes Japanese and Chinese (PRC or Traditional):
 * 1) include
 * 2) include

wrap both inclusions with the appropriate language statement.



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 Behavior
The following steps reproduce the RC1024 error:  Using the MFC AppWizard (exe), create a new project. In the MFC AppWizard step 1, select Single document and select Japanese as the language for the resources. Click Finish. Using the MFC AppWizard (exe), create a new project and add it to the workspace that you've just created. In the MFC AppWizard, in step 1, select Single document and select Chinese (Taiwan) as the language for the resources.</li> Click Finish.</li> Set the Japanese project as the active project by using the Set active project on the Project menu.</li> Select Resource Includes from the View menu.</li>  Scroll to the end of the Compile-time Directives list box and include the Chinese resource script. </li> Build the Japanese project.</li></ol>
 * 1) include .rc

The following steps reproduce the RC1022 error: <ol> Select Resource Includes from the View menu.</li> Remove the inclusion of the Chinese resource script.</li> Set the Chinese project as the active project by using Set active project on the Project menu.</li> Select Resource Includes from the View menu.</li>  Scroll to the end of the Compile-time Directives list box and include the Japanese resource script. </li> Build the Chinese project.</li></ol>
 * 1) include .rc

Keywords: kbbug kbcompiler KB248094

-

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

© Microsoft Corporation. All rights reserved.