RC.EXE, the Microsoft SDK Resource Compiler

From RAD Studio
Jump to: navigation, search

Go Up to Command-Line Utilities Index

RC is the command-line version of the standard Microsoft SDK resource compiler. It accepts a resource script file (.RC) as input and produces a resource object file (.RES) as output.

Both C++Builder and Delphi give you a choice of resource compilers. On the Project > Options > Resource Compiler dialog box, you can select either of the following:

  • BRCC32.exe, the C++Builder resource compiler
  • RC.exe, the Microsoft platform SDK Resource Compiler

RC supports Unicode characters in resource files and file names, as well as new Vista resource types such as icons with alpha channel.

The actual file name of the RC compiler in the RAD Studio environment is CGRC.exe.

Differences Between BRCC32 and RC

If you choose to use RC, several differences between BRCC32 and RC need to be addressed in existing .RC files, as follows:

  • To use Windows types or constants with RC, you need to explicitly
#include winresrc.h for both C++ and Delphi.
  • RC does not handle image data inline as BRCC32 does. To use an image with RC, you need to save the image and refer to the image inline.
  • RC handles line continuation differently than BRCC32. The simplest change is to combine strings with embedded newlines \n.
  • For RC, the order of command elements requires that all command options must come first, before the name of the resource file.
  • RC does not allow trailing commas after the string in a STRINGLIST.
  • RC treats strings as C-style strings. This means that you need to do either of the following:
    • Escape a single backslash \ in file names by using a double backslash \\.
    • Use a forward slash / in place of a single backslash \.
  • For RC, specifying #include <dirname> does not search the current directory. To search the current directory, use
#include "dirname".
  • To embed a double quotation mark in a string, use two consecutive double quotation mark characters "" instead of using the backslash escape character.
  • RCDATA and byte values are handled differently. For example:
    • BRCC32 treats '11 aa 22 bb' as a string of bytes.
    • For RC, you would need to specify 0xaa11 0xbb22.

See Also