By default, CrashRpt archive's bin
directory contains binary files compiled in Visual Studio 2010. These files are provided for demonstration purposes only. It is strongly recommended that you compile CrashRpt yourself using your version of Visual Studio. This is needed to ensure CrashRpt uses the same version of C run-time libraries (CRT) as your application does.
The top-level directory of CrashRpt distribution contains solution file for Visual Studio 2010 (CrashRpt_vs2010.sln
). Open this solution file to compile CrashRpt in Visual C++ 2010
or in Visual C++ Express 2010
- If you use another version (not 2010) of Visual Studio, you can generate solution/project files for your version of Visual Studio using CMake. See below for instructions.
To build the solution, choose the Release
build configuration and press F7 to start building process.
When build finishes, CrashRpt executable files can be found in bin directory, and library files can be found inside of lib directory. The following files are the most important:
- bin\CrashRptXXXX.dll - this is the CrashRpt crash handler module;
- bin\CrashSenderXXXX.exe - this is the crash report sender module;
- lib\CrashRptXXXX.lib - this the CrashRpt import library.
Above, XXXX placeholder should be the version number of CrashRpt.
Typically, you compile CrashRpt in Release
configuration. In this configuration, the build produces binary files that can be used in production environment.
The Debug configuration is used for CrashRpt debugging and should not be used for production mode. In this configuration, the build generates d-postfixed files, for example, CrashRptXXXXd.dll, CrashSenderXXXXd.exe and so on.
The Release LIB configuration is an addition to the standard Debug and Release build configurations. Typically, you should compile CrashRpt in Release configuration, but the Release LIB configuration may be useful if you use static CRT linkage.
In the Release LIB configuration, the build generates CrashSenderXXXX.exe executable file and CrashRptLIB.lib static library. In this configuration, CrashSenderXXXX.exe and CrashRptLIB.lib use static linkage to CRT.
You can generate Visual Studio project files using CMake
cross-platform make system. Although CrashRpt doesn't support operating systems other than Windows and doesn't support compilers other than Visual C++, CMake is useful, because it makes it easier to maintain multiple build configurations between different versions of Visual Studio.
To generate CrashRpt solution/project files for your favorite version of Visual Studio with CMake, do the following:
- Download CMake (version 2.8 or later) and install it. This will create CMake shortcuts in All Programs menu in the Start menu.
- Run CMake (cmake-gui) application. This will display the cmake-gui window.
- In the Where is the source code: field, enter the path to your top-level directory of CrashRpt distribution. The top-level directory and its subdirectories contain CMakeLists.txt files which are CMake configuration files.
- In the Where to build the binaries: field, enter the path to the directory where you want to generate project files. It is recommended to enter the path to your top-level directory of CrashRpt distribution here, too.
- Press the Configure button. When prompted, select your version of Visual Studio from the list. If everything is OK, you should see the message "Configuring done".
- In the option list, modify build options as you wish.
- CRASHRPT_BUILD_SHARED_LIBS option controls whether to build CrashRpt as DLL or as a static LIB. It is recommended that you have this checked. Unchecking the option will force CrashRpt to build static libs instead of DLLs (this is equivalent to Release LIB build configuration).
- CRASHRPT_LINK_CRT_AS_DLL option controls how CrashRpt should be linked to C run-time (CRT) libraries. Unchecking this option will force CrashRpt to link CRT as a multi-threaded static library (this is equivalent to Release LIB build configuration). It is recommended that you have this checked, which results in linking CRT as multi-threaded DLL.
- After modifying the options, press the Configure button the second time to force changes to make effect. If everything is OK, you should see the message "Configuring done".
- Press the Generate button. This will generate project files to the directory you have specified. If everything is OK, you should see the message "Generating done".
- And finally, go to the directory you have specified in the Where to build the binaries: field. You should see the generated CrashRpt.sln file that you can use to compile CrashRpt (open it in Visual Studio).
There are several projects in CrashRpt solution.
Structure of CrashRpt solution as seen in Solution Explorer window
- ConsoleDemo is a console application that helps to test how CrashRpt works with console applications.
- CrashRpt project contains API implementation and provides functionality for intercepting exceptions.
- CrashRptProbe project contains functionality for processing error reports.
- CrashSender project contains functionality for displaying GUI, sending the error report and showing error report sending progress.
- crprober is a console tool for error reports processing.
- jpeg project contains JPEG file management functionality.
- libogg project contains OGG video container management functionality (used together with libtheora).
- libpng project contains PNG file management functionality.
- libtheora project contains OGG Theora video codec functionality.
- MFCDemo is a GUI application that helps to test that CrashRpt API functions work as expected with a MFC-based application.
- minizip project contains ZIP file management functionality.
- Tests project contains automated tests.
- tinyxml project contains XML file management functionality.
- WTLDemo is a GUI application that helps to test that CrashRpt API functions work as expected with a WTL-based application.
- zlib project contains file compression functionality.
CrashRpt can be compiled for both 32-bit (Win32) and 64-bit (x64) platforms. You can choose the current platform by opening menu Build->Configuration Manager... and by selecting the desired platform from the 'Active solution platform:' combo box.
If you use CMake to generate project files, select a 64-bit compiler from the drop-down list when configuring CMake.
You should have x64 compiler tools and SDK files properly installed (ensure you have checked these components during Visual C++ installation).
Compilation in free Visual C++ Express is a little more complicated than compilation in a commercial edition of Visual C++.
CrashRpt depends on WTL. WTL itself depends on Microsoft's library called ATL (Active Template Library). ATL library is a part of Visual Studio SDKs. An older version, ATL 3.0, is included into Microsoft Platform SDK for Windows Server 2003. Since then, Platform SDK was renamed into Windows SDK. However, Microsoft doesn't include ATL into Windows SDK to encourage using of commercial Visual Studio having ATL.
So, there are two ways to compile CrashRpt in Visual C++ Express:
Recommended way. Install Windows Driver Kit, version 7.0 or later, because it contains ATL 7.1 source code. When WinDDK is installed, in VC++ Express window, open Tools->Options...->Projects and Solutions-> VC++ Directories. In the 'Show directories for' combo, select 'Include files' and then add C:\WinDDK\6001.18002\inc\crt\atl71 path to the list of include directories.
Alternative way. You need to have Platform SDK for Windows Server 2003, because this Platform SDK contains ATL 3.0 source code. Download and install Microsoft Platform SDK for Windows Server 2003, for example from here.
In VC++ Express window, open Tools->Options...->Projects and Solutions-> VC++ Directories. In the 'Show directories for' combo, select 'Include files' and then add <Platform_SDK_Folder>\Include\atl path to the list of include directories (replace the <Platform_SDK_Folder> with the actual directory name).
By default, project documentation is already generated and included into the CrashRpt distribution. To open the documentation, click
file in the top-level directory of CrashRpt distribution.
You can also build documentation yourself. CrashRpt documentation can be generated using the Doxygen tool. You can download the tool from here.
To build the documentation, go to the
docs folder and type in the command line:
When doxygen finishes, go to the top level directory and open
Further reading: Configuring Your Project's Build Settings.