2.3.3 Defining Names for the Preprocessor

You can specify conditional branching in a resource-definition file, based on whether a term is defined on the rc command line with the /d option.

For example, suppose your application has a pop-up menu, the Debug menu, that should appear only during debugging. When you compile the application for normal use, the Debug menu is not included. The following example shows the statements that can be added to the resource-definition file to define the Debug menu:

MainMenu MENU
BEGIN
  .
  .
  .
#ifdef DEBUG
        POPUP "&Debug"
        BEGIN
                MENUITEM "&Memory usage", ID_MEMORY
                MENUITEM "&Walk data heap", ID_WALK_HEAP
        END
#endif
END

When compiling resources for a debugging version of the application, you could include the Debug menu by using the following rc command:

rc -r -d debug myapp.rc

To compile resources for a normal version of the application—one that does not include the Debug menu—you could use the following rc command:

rc -r myapp.rc