Compiling Resources

As described earlier in "Compiling an Application Command Table," the resource compiler rcomp generates resources from ASCII source files, storing them in resource files to be used by MDL applications.

Resource compiler source files are usually denoted by the file extension, .r. The default extension for generated output files is .rsc.

Because of the wide variety of data that can be stored in a resource file, this section will not describe the construction of resource source files. For information on doing so, refer to the "Resources" chapter.


A listing of basic.r, the resource file for, can be found in "A Complete Example".

Command line syntax

rcomp [options] source_filename

The following options are supported:

flag description
-c Suppress generation of "root" level CMD_ macros when subcommands are required (REQ in command tables). This only applies when the "-h" option is specified.
-d<name>=<value> Define name with the value value as if it is defined by a #define statement. This option does not require =value.
-f Specify resource file format.
-h Generate a C header file of CMD_ defines when compiling command tables.
-ho<filename> Generate a C header file of CMD_ defines when compiling command tables and allow the filename to be specified.
-i<dir> Search this directory for include files.
-o<filename> Specify explicit output filename. If this option is not specified, the output filename is determined from the input filename. The default extension for output files is .rsc.
-p Display preprocessed output.
-pi Trace include file history. If this flag is defined, then every time the compiler encounters an #include preprocessor directive, it displays both the name of the file that contains the #include statement, and the name of the file to be included.
-r Generate a definition resource for each resourceclass.
-t<directory> Directory to search for #pragma translate resources. If not specified, current directory is searched.
-v Verbose: show progress of the compiler. </tr

The command line switches and input filename can be provided in any order. Response files can be used to specify command line switches as well as the input filename to the compiler as the following example shows:

RCOMP -ddebug @args.txt

The contents of args.txt are as follows:

"-v -ic:\mydir\myhdr.-h input.r" (PC)


The resource entry in basicrsc.mki reads:

$(rscObjects)basic.rsc : $(BaseDir)basic.r $(langSpec)basictxt.h \

This calls the .r.rsc: rule in mdl.mki, which subsequently calls rcomp.

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.