source Configuration File Directive

The source directive specifies files that are used as inputs to a build. Usually a target directive has at least one source subdirective to specify the source files that must be processed to create the target file. Options in effect when the source directive is processed are applied to those source files.

This diagram shows the syntax of the source directive:

The source directive has the following parameters:

type(string)
The optional type clause overrides one of the standard type assignments, or specifies the type for a file with an extension that is not recognized.

source_list
The source list is a list of strings, separated by commas, and can consist of data elements that represent file names or the names of source groups that are defined in prior group directives. Primary C and C++ sources can be specified with absolute or relative paths. You can supply paths for libraries or object files that you specify as source files. If an library or object file is not found on the specified path, linker search path is used.

For example, the following lines from a configuration file use source files of differing types:

/* parta.c is a C++ source, not a C source */
source type(cpp) "parta.c"
/* A C++ source, a resource source and an object file are sources. */
source "partm.cpp", "respart.rc", "oldpart.obj"

If a source directive specifies a file that is already listed as a source file, VisualAge C++ treats each occurrence of the file as a separate and unrelated source file.

The one-definition rule limits the way you can reuse C++ source files in one codestore. You can specify the same source file more than once only when one of the following criteria are satisfied:



Configuration Files
How Configuration Files Are Processed
C++ Source Files and Source Regions
One-Definition Rule
Search Paths for Primary Source Files
Linker Searches


Change a Build Setup
Add or Change Source Files
Override the Default Type of a Source File
Set Build Options
Build


Configuration File Directives
Types of Source Files
Build Options