Share via


C Run-Time Debug Libraries

The following table lists the debug versions of the C run-time library files, along with their associated compiler options and environment variables. For a list of the release versions of these libraries, see C Run-Time Libraries.

Prior to Visual C++ 4.2, the C run-time libraries contained the iostream library functions. In Visual C++ 4.2, the old iostream library functions were removed from LIBCD.LIB, LIBCMTD.LIB, and MSVCRTD.LIB. This change was made because the Standard C++ library was added to Visual C++, and it contains a new set of iostream libraries.

Two sets of iostream functions are now included in Visual C++. The old iostream functions now exist in their own libraries: LIBCID.LIB, LIBCIMTD.LIB, and MSVCIRTD.LIB. The new iostream functions, as well as many other new functions, exist in the Standard C++ libraries: LIBCPD.LIB, LIBCPMTD.LIB, and MSVCPRTD.LIB.

The Standard C++ library and the old iostream library are incompatible and only one of them can be linked with your project. See the and Make the Old iostream Library the Default for details.

When you build a debug version of your project, one of the basic C run-time debug libraries (LIBCD.LIB, LIBCMTD.LIB, and MSVCRTD.LIB) is linked by default, depending on the compiler option you choose (single-threaded, multithreaded, or DLL). Depending on the headers you use in your code, a debug library from the Standard C++ libraries or one from the old iostream libraries may also be linked.

  • If you include a in your code, a Standard C++ library will be linked in automatically by Visual C++ at compile time. For example:
   #include <ios>
  • If you include an old iostream library header, an old iostream library will be linked in automatically by Visual C++ at compile time. For example:
   #include <ios.h>

Note that headers from the Standard C++ library and the old iostream library cannot be mixed.

Headers determine whether a Standard C++ library, an old iostream library, or neither will be linked. Compiler options determine which of the libraries to be linked is the default (single-threaded, multithreaded, or DLL). When a specific library compiler option is defined, that library is considered to be the default and its environment variables are automatically defined.

C Run-Time Debug Library (without iostream) Characteristics Option Defined
LIBCD.LIB Single-threaded, static link /MLd _DEBUG
LIBCMTD.LIB Multithreaded, static link /MTd _DEBUG, _MT
MSVCRTD.LIB Multithreaded, dynamic link
(import library for MSVCRTD.DLL)1
/MDd _DEBUG, _MT, _DLL
1   In place of the “x” in the DLL name, substitute the major version numeral of Visual C++ that you are using. For example, if you are using Visual C++ version 4, then the library name would be MSVCR40D.DLL.
Standard C++ Debug Library Characteristics Option Defined
LIBCPD.LIB Single-threaded, static link /MLd _DEBUG
LIBCPMTD.LIB Multithreaded, static link /MTd _DEBUG, _MT
MSVCPRTD.LIB Multithreaded, dynamic link (import library for MSVCRTD.DLL) /MDd _DEBUG, _MT, _DLL
iostream Debug Library Characteristics Option Defined
LIBCID.LIB Single threaded, static link /MLd _DEBUG
LIBCIMTD.LIB Multithreaded, static link /MTd _DEBUG, _MT
MSVCIRTD.LIB Multithreaded, dynamic link (import library for MSVCIRTD.DLL) /MDd _DEBUG, _MT, _DLL

The debug versions of the library functions differ from the release versions mainly in that debug information was included when they were compiled (using the /Z7 or /Zi compiler option), optimization was turned off, and source code is available. A few of the debug library functions also contain asserts that verify parameter validity.

Using one of these debug libraries is as simple as linking it to your application with the /DEBUG:FULL linker option set. You can then step directly into almost any run-time function call.