PRB: C2188 Error Including AFXWIN.H in an RC File
PSS ID Number: Q102699
Article last modified on 03-07-1994

1.00

WINDOWS


----------------------------------------------------------------------
The information in this article applies to:

 - Microsoft Foundation Classes for Windows, version 1.0, which is
   included with Microsoft C/C++ for MS-DOS and Windows, version 7.0
----------------------------------------------------------------------

SYMPTOMS
========

An attempt to compile resources for an application may fail and the
Resource Compiler may generate the following message:

   c:\c700\mfc\include/afx.h(18): error c2188 :#error : Microsoft
   Foundation Classes require C++ compilation (use a .cpp suffix)

CAUSE
=====

The application's resource (.RC) file includes the AFXWIN.H file. The
error occurs because the AFXWIN.H file for version 1.0 of the
Microsoft Foundation Classes does not include appropriate preprocessor
directives to prevent it from being processed by the Resource
Compiler.

RESOLUTION
==========

Edit your .RC file to substitute AFXRES.H for AFXWIN.H in the .RC file
to avoid this error message. The AFXWIN.H file for version 2.0 of the
Microsoft Foundation Classes includes appropriate preprocessor
directives to prevent it from being processed by the Resource
Compiler; instead, it includes AFXRES.H.

STATUS
======

Microsoft has confirmed this to be a problem in Microsoft Foundation
Classes version 1.0 for Windows. This problem was corrected in
Microsoft Foundation Classes version 2.0 for Windows.

MORE INFORMATION
================

The following code example generates a C2188 error when you use the
AFXWIN.H file for version 1.0 of the Microsoft Foundation Classes
libraries for Windows:

Sample Code - TEST.RC
---------------------

/*
 * Command line needed: rc -r test.rc
 */

#include <afxwin.h>

Additional reference words: 1.00
KBCategory: Tls
KBSubcategory:

=============================================================================

Copyright Microsoft Corporation 1994.
