Libcwd is a thread-safe, full-featured debugging support library for C++ developers. It includes ostream-based debug output with custom debug channels and devices, as well as run-time support for printing source file:line number information and demangled type names.
How to install and use libcwd
Tutorial on How to set up a project to use cmake and libcwd has been added here (July 2026): https://www.youtube.com/watch?v=9tQnhOGK0zo
This first shows how to use pure libcwd - then shows what to add to your CMakeLists.txt to use gitache to automatically fetch libcwd, and finally demonstrates how to add and use the git submodules cmake-aicxx and cwds.
THE DIRECTORY example-project' CONTAINS A COMPLETE EXAMPLE that shows how to use libcwd in a cmake project. It might be faster to just examine that.
Introduction
Libcwd is for use by developers while still developing: end applications don't need it. While still developing, you will compile with -DCWDEBUG and link with -lcwd (and add its install path to LDLIBRARYPATH). A production version is then simply compiled without -DCWDEBUG and not linked with -lcwd.
Please read the INSTALL file for a list of other needed libraries and tools before attempting to compile libcwd.
The debug support can be divided into the following components:
1) Support for Object Oriented debug output (using ostream and debug objects for channels' and `devices'). 2) General runtime debugging support (demangling, stack and call traces, break points (starting a gdb session from within the program), tracking and handling existing functions as objects, etc).
Detailed documentation and a tutorial can be found in the directory doc/.