Microsoft KB Archive/248094: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - "<" to "<")
Line 52: Line 52:
<div class="errormessage">
<div class="errormessage">


&lt;path&gt;\RC''XXXXXX''(''YYYY'') : fatal error RC1022: expected '#endif'
<path&gt;\RC''XXXXXX''(''YYYY'') : fatal error RC1022: expected '#endif'


</div>
</div>
Line 63: Line 63:
<div class="errormessage">
<div class="errormessage">


&lt;path&gt;\&lt;file name&gt;.rc (''YYYY''): error RC2104 : undefined keyword or key name
<path&gt;\<file name&gt;.rc (''YYYY''): error RC2104 : undefined keyword or key name


</div>
</div>
Line 86: Line 86:
<br />
<br />
If the resource script includes Chinese (Taiwan) resources:
If the resource script includes Chinese (Taiwan) resources:
<pre class="codesample">#include &lt;chinese taiwan script&gt;.rc
<pre class="codesample">#include <chinese taiwan script&gt;.rc
                 </pre>
                 </pre>
wrap the inclusion as follows:
wrap the inclusion as follows:
Line 94: Line 94:
#pragma code_page(950)
#pragma code_page(950)
#endif //_WIN32
#endif //_WIN32
#include &lt;chinese taiwan script&gt;.rc
#include <chinese taiwan script&gt;.rc
#endif
#endif
                 </pre>
                 </pre>
Line 100: Line 100:
<br />
<br />
If the resource script contains Chinese (PRC) resources:
If the resource script contains Chinese (PRC) resources:
<pre class="codesample">#include &lt;chinese prc script&gt;.rc
<pre class="codesample">#include <chinese prc script&gt;.rc
                 </pre>
                 </pre>
wrap the inclusion as follows:
wrap the inclusion as follows:
Line 108: Line 108:
#pragma code_page(936)
#pragma code_page(936)
#endif //_WIN32
#endif //_WIN32
#include &lt;chinese prc script&gt;.rc
#include <chinese prc script&gt;.rc
#endif
#endif
                 </pre>
                 </pre>
Line 114: Line 114:
<br />
<br />
If the resource script includes Japanese resources:
If the resource script includes Japanese resources:
<pre class="codesample">#include &lt;japanese script&gt;.rc
<pre class="codesample">#include <japanese script&gt;.rc
                 </pre>
                 </pre>
wrap the inclusion as follows:
wrap the inclusion as follows:
Line 122: Line 122:
#pragma code_page(932)
#pragma code_page(932)
#endif //_WIN32
#endif //_WIN32
#include &lt;japanese script&gt;.rc
#include <japanese script&gt;.rc
#endif
#endif
                 </pre>
                 </pre>
Line 128: Line 128:
<br />
<br />
If the resource script includes Japanese and Chinese (PRC or Traditional):
If the resource script includes Japanese and Chinese (PRC or Traditional):
<pre class="codesample">#include &lt;japanese script&gt;
<pre class="codesample">#include <japanese script&gt;
#include &lt;chinese script&gt;
#include <chinese script&gt;
                 </pre>
                 </pre>
<br />
<br />
Line 159: Line 159:
<li>Select '''Resource Includes''' from the '''View''' menu.</li>
<li>Select '''Resource Includes''' from the '''View''' menu.</li>
<li><p>Scroll to the end of the '''Compile-time Directives''' list box and include the Chinese resource script.</p>
<li><p>Scroll to the end of the '''Compile-time Directives''' list box and include the Chinese resource script.</p>
<pre class="codesample">#include &lt;chinese script&gt;.rc
<pre class="codesample">#include <chinese script&gt;.rc
                     </pre></li>
                     </pre></li>
<li>Build the Japanese project.</li></ol>
<li>Build the Japanese project.</li></ol>
Line 172: Line 172:
<li>Select '''Resource Includes''' from the '''View''' menu.</li>
<li>Select '''Resource Includes''' from the '''View''' menu.</li>
<li><p>Scroll to the end of the '''Compile-time Directives''' list box and include the Japanese resource script.</p>
<li><p>Scroll to the end of the '''Compile-time Directives''' list box and include the Japanese resource script.</p>
<pre class="codesample">#include &lt;japanese script&gt;.rc
<pre class="codesample">#include <japanese script&gt;.rc
                     </pre></li>
                     </pre></li>
<li>Build the Chinese project.</li></ol>
<li>Build the Chinese project.</li></ol>

Revision as of 09:00, 21 July 2020

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:

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

-or-


<path>\<file name>.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:

#include <chinese taiwan script>.rc
                

wrap the inclusion as follows:

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHT)
#ifdef _WIN32
LANGUAGE 4, 1
#pragma code_page(950)
#endif //_WIN32
#include <chinese taiwan script>.rc
#endif
                



If the resource script contains Chinese (PRC) resources:

#include <chinese prc script>.rc
                

wrap the inclusion as follows:

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
#ifdef _WIN32
LANGUAGE 4, 2
#pragma code_page(936)
#endif //_WIN32
#include <chinese prc script>.rc
#endif
                



If the resource script includes Japanese resources:

#include <japanese script>.rc
                

wrap the inclusion as follows:

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
#ifdef _WIN32
LANGUAGE 17, 1
#pragma code_page(932)
#endif //_WIN32
#include <japanese script>.rc
#endif
                



If the resource script includes Japanese and Chinese (PRC or Traditional):

#include <japanese script>
#include <chinese script>
                


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.

MORE INFORMATION

Steps to Reproduce Behavior

The following steps reproduce the RC1024 error:

  1. Using the MFC AppWizard (exe), create a new project.
  2. In the MFC AppWizard step 1, select Single document and select Japanese as the language for the resources.
  3. Click Finish.
  4. Using the MFC AppWizard (exe), create a new project and add it to the workspace that you've just created.
  5. In the MFC AppWizard, in step 1, select Single document and select Chinese (Taiwan) as the language for the resources.
  6. Click Finish.
  7. Set the Japanese project as the active project by using the Set active project on the Project menu.
  8. Select Resource Includes from the View menu.
  9. Scroll to the end of the Compile-time Directives list box and include the Chinese resource script.

    #include <chinese script>.rc
                        
  10. Build the Japanese project.



The following steps reproduce the RC1022 error:

  1. Select Resource Includes from the View menu.
  2. Remove the inclusion of the Chinese resource script.
  3. Set the Chinese project as the active project by using Set active project on the Project menu.
  4. Select Resource Includes from the View menu.
  5. Scroll to the end of the Compile-time Directives list box and include the Japanese resource script.

    #include <japanese script>.rc
                        
  6. Build the Chinese project.


Keywords: kbbug kbcompiler KB248094