The information in this article applies to:
SUMMARYIn Visual C++, default libraries can be linked to automatically. This is done for the C run-time libraries. The compiler writes a default C run-time library name in the object (.obj) files it creates. The library name depends on the compiler options you use. For additional information, please see the following article in the Microsoft Knowledge Base: Q128641 The /Mx Compiler Options and the LIBC, LIBCMT, MSVCRT LibsYou can also specify default libraries by the using the #pragma comment() compiler directive. The Microsoft Foundation Class (MFC) header files do this. Writing a default library name in an object file in this manner saves you from having to specify the library on the linker command line. However, sometimes it is necessary to determine which libraries an object file links to by default. MORE INFORMATIONTo see which libraries an object file will use by default, you can use the Dumpbin.exe utility in a console session. For example, to find out which libraries Mfcapp.obj will cause the linker to search automatically, you would use the following code (this example pipes the output to a file):
In the column to the right side of the output, you'll see the list of
default libraries; the following is an excerpt from that column:
From this excerpt, you can determine this object file will cause the linker
to automatically search Mfc40.lib, Msvcrt.lib, Kernel32.lib, and User32.lib
when building an executable file. As you can see, each library name is
preceded with "-defaultlib:". You can use this procedure for multiple
object files, and compare the output of each file.
One reason you may need to determine which default library names are in an object file is to troubleshoot the LNK2005 error, "symbol multiply defined." Additional query words:
Keywords : kbVC200 kbVC210 kbVC400 kbVC500 kbVC600 TlsMisc |
Last Reviewed: December 7, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |