Linker Searches

You can specify libraries and object files as sources in configuration files. To create a target, the linker satisfies references to symbols in these files by searching them in the following order:

  1. Object files are searched first, in the order in which they appear inside the target directive in your configuration file.
  2. Libraries are searched next, in the order in which they appear inside the target directive in your configuration file.
  3. If you name libraries in source directives that are not subdirectives of any target directives, these libraries are searched after sources listed in the target directive for the target being built. The libraries are searched in the order in which they appear in your configuration file, regardless of whether they appear before or after the target directive.
  4. The libraries supplied with VisualAge C++ are searched last.

For example, consider the following excerpt from a configuration file:

source "a.lib" 
target "myprog.exe" { source "myprog.cpp", 
                             "b.lib",
                             "e.obj",
                             "c.lib",
                             "d.obj"} 
source "f.lib"

In this example, the files are searched in the following order:

  1. e.obj
  2. d.obj
  3. b.lib
  4. c.lib
  5. a.lib
  6. f.lib

On OS/2 and Windows NT platforms, if a library contains a reference to a symbol that is not known the linker searches first the library that contains the reference, and then looks all the other libraries in the order described above.

The paths that VisualAge C++ searches for libraries and object files are established as follows:



Configuration Files
Search Paths for Primary Source Files
Search Paths for Included Source Files
Search Paths for Included Source Files


Add or Change Source Files
Set Build Options
Build
Choose Your Run-Time Library
Build with Existing Object Files and Libraries


Build Options