PRB:Resolving RC "Compiler (Internal) out of Heap Space" Error

ID Number: Q38528

2.03 2.10 3.00

WINDOWS

SYMPTOMS

When running the Resource Compiler (RC), the error "compiler

(internal) out of heap space" was returned. It was possible to

correct this error by changing the header file from WINDOWS.H to

STYLE.H. This worked correctly for a while, however, then the same

error started occurring again.

CAUSE

This error is occurring because the RC memory preprocessor

(RCPP.EXE) is running out of memory while processing include files

and/or macro definitions.

This problem is much less common in the version of RC included with

the Windows version 3.0 SDK (Software Development Kit) than in

version of RC included with the Windows version 2.x SDK because of

improvements made to the version of RCPP included with the Windows

version 3.0 SDK.

RESOLUTION

The only way to work around this problem is to reduce unnecessary

definitions. In addition to switching from WINDOWS.H to STYLE.H,

the application include files should also be examined for

unnecessary (to RC) definitions. (Note: STYLE.H is included only

with the Windows 2.x SDK.)

RC defines a preprocessor symbol called RC_INVOKED. This symbol can

be used to remove unnecessary definitions to save preprocessor

memory. For example:

#define ID_BUTTON 100 /* Resource ID definitions */

#define ID_STRING 200

...

#ifndef RC_INVOKED /* Do this for CL, however, not

for RC */

#define MYMACRO(x,y,x) .... /* Used only when compiling C

code */

typedef struct _mystuff

{

...

} ...

#endif