| crashrpt |
A crash reporting system for Windows applications

# Configuring Your Project's Build Settings

## Include and Lib Directories

At this point you should have the CrashRpt source code compiled as described in Compiling CrashRpt.

To let your Visual C++ compiler and linker know about the location of CrashRpt include and lib files, do the following.

In Visual Studio window, open Tools-> Options->Projects and Solutions->VC++ Directories.

- In the 'Show directories for' combo box, select 'Include files', then add the path to [CRASHRPT_HOME]\include directory to the list.
- In the 'Show directories for' combo box, select 'Library files', then add the path to [CRASHRPT_HOME]\lib directory to the list.

Here [CRASHRPT_HOME] should be replaced with the actual path of the directory you unzipped CrashRpt distribution to.

Note:
  In previous versions, include files were stored in [CRASHRPT_HOME]\CrashRpt\include. Since v1.2.0, all include files are stored in [CRASHRPT_HOME]\include directory.

Before you start using CrashRpt API functions in your program, do not forget to include `CrashRpt.h` header file in the beginning of your code:

    // Include CrashRpt header
    #include "CrashRpt.h"

You also need to add CrashRpt LIB file to the list of input libraries for your project. In the Solution Explorer window, right-click your project and choose Properties item from the context menu. Then open Configuration Properties->Linker->Input->Additional Dependencies and then add CrashRpt.lib to the list of libraries.

## Using CRT as Multi-Threaded DLL (/MD) in Release Configuration

It is important that you configure your project to use C runtime libraries (CRT) as Multi-threaded DLL (/MD) for Release configuration. This is the way recommended in MSDN. See the Exception Handling and CRT Linkage for more information.

In the Solution Explorer window, right-click your project and open project Properties. Then choose Configuration Properties->C/C++->Code Generation. In the Runtime Library field, choose Multi-threaded DLL (/MD). See the figure below for example.

This should be done for all projects in your solution to share single CRT DLL.

Note:

In Debug configuration it is not important what CRT linkage you use. Typically your default debugger intercepts exceptions instead of CrashRpt in Debug configuration.

Multi-threaded DLL (/MD)

## Using the Same Version of CRT for All Application Modules

Ensure that all modules that exist in your application use the same version of CRT. If some dependent modules were compiled using an older version of CRT, you should recompile them to ensure the single version or CRT DLL is used.

For example, assume you use Visual Studio 2005 and CRT 8.0 linked as DLL, but some dependent module in your application was compiled in Visual Studio .NET 2003 and uses CRT 7.1 linked as DLL. In such situation a CRT error in the dependent module won't be intercepted by CrashRpt, because error handlers are installed by you program for CRT 8.0 only.

## Enabling Program Database (/Zi, /DEBUG) in Release Configuration

To get the most out of the crash minidump, the debugger needs your application's debug symbols. By default Release builds don't generate debug symbols.

1. In the Solution Explorer window, right-click your project and open project Properties. Then choose Configuration Properties->C/C++->General. In the Debug Information Format field, choose Program Database (/Zi).
2. Choose Configuration Properties->Linker->Debugging. In the Generate Debug Info field, choose Yes (/DEBUG).

Steps 1 and 2 should be done for all projects in your solution that support program database (EXE, DLL).

The steps 1 and 2 are presented on the figures below.

Program Database (/Zi)

Enabling Debugging Information in Linker

## FAQ

Does using crashrpt makes it easier for somebody to reverse engineer my code?

Actually not. To use CrashRpt you enable program database generation in Release configuration (/Zi compiler flag and /DEBUG linker flag) and this generates .PDB file for your project. PDB file contains information that can be used to reverse engineer your code, however you typically store it locally and do not distribute with your software release package. So, using crashrpt doesn't affect the difficulty of reverse engineering your code.