Using Intel® Visual Fortran to Create and Build Windows*-Based Applications

ID 757211
Date 7/23/2021
Document Table of Contents

Including Resources Using Multiple Resource Files

Normally it is easy and convenient to work with the default arrangement of all resources in one resource definition (.RC) file. However, you can add resources in other files to your current project at compile time by listing them in the compile-time directives box in the Resource Includes dialog box.

There are several reasons to place resources in a file other than the main .RC file:

  • To include resources that have already been developed and tested and do not need further modification.

  • To include resources that are being used by several different projects, or that are part of a source code version-control system, and thus must exist in a central location where modifications will affect all projects.

  • To include resources that are in a custom format.

  • To include statements in your resource file that execute conditionally at compile time using compiler directives, such as #ifdef and #else. For example, your project may have a group of resources that are bracketed by #ifdef _DEBUG ... #endif and are thus included only if the constant _DEBUG is defined at compile time.

  • To include statements in your resource file that modify resource-file syntax by using the #define directive to implement simple macros.

If you have sections in your existing .RC files that meet any of these conditions, you should place the sections in one or more separate .RC files and include them in your project using the Resource Includes dialog box.

To include resource files that will be added to your project at compile time:

  1. Place the resources in an RC file with a unique filename. (Do not use projectname.rc, since this is the default filename used for the main resource script file.)

  2. From the Edit menu, choose Resource Includes.

  3. In the Compile-time directives box, use the #include compiler directive to include the new resource file in the main resource file in the development environment. The resources in files included in this way are made a part of your executable file at compile time. They are not directly available for editing or modification when you are working on your project's main .RC file. You need to open included .RC files separately.

  4. Click OK.