CRT Debug Library Use


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at CRT Debug Library Use.

The C run-time library provides extensive debugging support. To use one of the CRT debug libraries, you must link with /DEBUG and compile with /MDd, /MTd, or /LDd.

The main definitions and macros for CRT debugging can be found in the CRTDBG.h header file.

The functions in the CRT debug libraries are compiled with debug information (/Z7, /Zd, /Zi, /ZI (Debug Information Format)) and without optimization. Some functions contain assertions to verify parameters that are passed to them, and source code is provided. With this source code, you can step into CRT functions to confirm that the functions are working as you expect and check for bad parameters or memory states. (Some CRT technology is proprietary and does not provide source code for exception handling, floating point, and a few other routines.)

When you install Visual C++, you have the option of installing the C run-time library source code on your hard disk. If you do not install the source code, you will need the CD-ROM to step into CRT functions.

For more information on the various run-time libraries you can use, see C Run-Time Libraries.

CRT Debugging Techniques
/MD, /MT, /LD (Use Run-Time Library)