首先根据其它经验,下载breakpad库,然后编译需要的三项,
common.lib
crash_generation_client.lib
exception_handler.lib
#include "minidump.h"
#include "exception_handler.h"
#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"common.lib")
#pragma comment(lib,"crash_generation_client.lib")
#pragma comment(lib,"exception_handler.lib")
//breakpad崩溃转储函数
bool BreakpadCallback(const wchar_t *dump_path, const wchar_t *id,
void *context, EXCEPTION_POINTERS *exinfo,
MDRawAssertionInfo *assertion,
bool succeeded)
{
if (succeeded) {
printf("dump guid is %ws\n", id);
}
else {
printf("dump failed\n");
}
system("pause");
return succeeded;
}
int _tmain(int argc, _TCHAR* argv[])
{
google_breakpad::ExceptionHandler eh(strCrashDir, NULL, BreakpadCallback, NULL, google_breakpad::ExceptionHandler::HANDLER_ALL);
可执行程序的.exe,和pdb要放在一起,如果可执行文件在其它计算机上,需要把其它计算机的dll拷贝过来。