Use the TARGETLIBS macro to specify other libraries that you want to link against when you build your image. This macro should be the primary method that you use to specify the libraries or objects that you want to link against to build your image.


Paths that are specified in TARGETLIBS must be absolute. Separate the entries in this list by using spaces or tabs.

The easiest way to define TARGETLIBS is to refer to the DDK_LIB_PATH, SDK_LIB_PATH, or CRT_LIB_PATH environment variable. For example:

TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \
           $(SDK_LIB_PATH)\advapi32.lib \
           $(SDK_LIB_PATH)\user32.lib   \

If you do not want to use these environment variables, you must define TARGETLIBS path names in a special way. Because the Build utility can create build products for several hardware platforms, the destination path for build products is constructed as follows:


where TARGETPATH is defined in the Sources file, and cpu_type specifies the platform for which the products were built.

For example, if TARGETPATH is defined as LIB and a build request is made for an x86 processor, the build products will be directed to the following subdirectory:


Because of this convention, TARGETLIBS entries should specify library names in the following form:


where targetpath is identical to the value assigned to TARGETPATH in the Sources file, and library_name is the full file name of the library to be linked to the executable file. The Build utility replaces the asterisk ( * ) with the target platform type.



Send comments about this topic to Microsoft

Build date: 5/3/2011