Linking google breakpad lib in our Qt app on Windows gives Unresolved external symbol
-
We have google breakpad compiled a Windows 7 64-bit desktop and Windows 7 32-bit laptop, both using Visual Studio 2008. We are trying to compile our Qt 4 app to include breakpad. Here's the pertinent section of the .pro file:
@
INCLUDEPATH += ./third_party/google_breakpad/srclinux-g++:LIBS += -L$${PWD}/third_party/build/google_breakpad/$${BUILD_MODE}/src/client/linux -lbreakpad_client
win32:LIBS += -L$${PWD}/third_party/google_breakpad/src/client/windows/Debug/lib -lexception_handler -lcrash_generation_client -lcommon
@It compiles, but when we link, we get:
main.obj:: error: unresolved external symbol "public: __thiscall google_breakpad::ExceptionHandler::ExceptionHandler(class std::basic_string<unsigned short,struct std::char_traits<unsigned short>,class std::allocator<unsigned short> > const &,bool (__cdecl*)(void *,struct _EXCEPTION_POINTERS *,struct MDRawAssertionInfo ),bool (__cdecl)(unsigned short const *,unsigned short const *,void *,struct _EXCEPTION_POINTERS *,struct MDRawAssertionInfo *,bool),void *,int)" (??0ExceptionHandler@google_breakpad@@QAE@ABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@P6A_NPAXPAU_EXCEPTION_POINTERS@@PAUMDRawAssertionInfo@@@ZP6A_NPBG5123_N@Z1H@Z) referenced in function _main
We've verified the constructor signature using dumpbin. We've also tried bringing our app into Visual Studio 2008 using the Qt plugin and we get the same error. Any ideas? Thanks!
[EDIT: code formatting, please wrap in @-tags, Volker]
-
Found an answer:
The issue is that the Google Breakpad library is compiled with "Treat wchar_t as Built-in Type" enabled (/Zc:wchar_t). Qt compiles with that option disabled (/Zc:wchar_t-). This means that at compile time, everything matches up: the std::wstring is defined in terms of unsigned short, which is what Qt expects. But at link time, the Breakpad library has defined wstring in terms of __wchar_t (or wchar_t). The effect is that the linker cannot resolve your call to their function, since the parameter types to not match (at link time.)
The solution is to either:
• disable the "Treat wchar_t as Built-in Type" in the Google Breakpad library (under Configuration Properties > C/C++ > Language.
• enable the option in Qt (remove /Zc:wchar_t-)For more information:
http://msdn.microsoft.com/en-us/library/dh8che7s(v=VS.90).aspx -
Hi,
[quote author="davidb" date="1297307740"]We are trying to compile our Qt 4 app to include breakpad.[/quote]
Do you use minGW GCC compiler bundled with QT SDK or Visual Studio Compiler for your app?
If the first is true, then how do you get breakpad header files compiled?.. They include DbgHelp.h, which in turn includes sal.h etc from Visual Studio headers, which is reportedly uncompilable by GCC -- and that's my current mileage while trying to plug breakpad into a Qt/win32-only project.
Thanks,