2.3.5 Controlling Which Directories the Resource Compiler Searches

By default, RC searches for header files and resource files (such as icon and cursor files) first in the current directory and then in the directories specified by the INCLUDE environment variable. (The PATH environment variable has no effect on which directories RC searches.)

2.3.5.1 Adding a Directory to Search

You can use the /i option to add a directory to the list of directories RC searches. The compiler then searches the directories in the following order:

1.The current directory

2.The directory or directories you specify by using the /i option, in the order in which they appear on the rc command line

3.The list of directories specified by the INCLUDE environment variable, in the order in which the variable lists them, unless you specify the /x option

The following example compiles the resource-definition file MYAPP.RC and adds the compiled resources to MYAPP.EXE:

rc /i c:\source\stuff /i d:\resources myapp.rc

When compiling the resource-definition file MYAPP.RC, RC searches for header files and resource files first in the current directory, then in C:\SOURCE\STUFF and D:\RESOURCES, and then in the directories specified by the INCLUDE environment variable.

2.3.5.2 Suppressing the INCLUDE Environment Variable

You can prevent RC from using the INCLUDE environment variable when determining the directories to search. To do so, use the /x option. The compiler then searches for files only in the current directory and in any directories you specify by using the /i option.

The following example compiles the resource-definition file MYAPP.RC and adds the compiled resources to MYAPP.EXE:

rc /x /i c:\source\stuff myapp.rc

When compiling the resource-definition file MYAPP.RC, RC searches for header files and resource files first in the current directory and then in C:\SOURCE\STUFF. It does not search the directories specified by the INCLUDE environment variable.