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/src
linux-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::ExceptionHandle r(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?$bas ic_string@GU?$char_traits@G@std@@V?$allocator@G@2@ @std@@P6A_NPAXPAU_EXCEPTION_POINTERS@@PAUMDRawAsse rtionInfo@@@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!
Re: linking google breakpad lib in our Qt app on Windows gives Unresolved external sy
This problem is unrelated to Qt, moving the thread to a more appropriate forum.
Re: linking google breakpad lib in our Qt app on Windows gives Unresolved external sy
Sorry, I didn't know it wasn't a Qt issue - I'm new to C++ and Qt. We 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/libr...(v=VS.90).aspx