我们试图将Crashpad与我们的Qt应用程序集成在一起,但遇到了几个错误。我们构建了Crashpad,并尝试使用.pro文件中的以下代码片段将其链接到我们的应用程序:
# Crashpad rules for Windows
win32 {
LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lbase
LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lclient
LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lutil
}在构建时,我们得到了大量的链接器错误,如下所示:
base.lib(base.file_path.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MDd_DynamicDebug' in main.obj我们看到了这个post,并决定使用/MDd标志构建Crashpad。将新的库复制到上面列出的目录后,使用Qt构建会产生以下错误:
fatal error C1007: unrecognized flag '-Ot' in 'p2'为什么MSVC抛出这个错误?我们正在使用14.0 MSVC工具集进行构建。
发布于 2020-06-16 04:05:12
这里的问题最终是工具集不匹配。忍者使用MSVC 2019工具集构建了Crashpad。安装在有问题的机器上的Qt版本是5.14.2,它使用MSVC 2017工具集。一旦我们安装了5.15.0套件并使用MSVC 2019构建配置构建,这个错误就消失了。
此外,一旦我们解决了前面的错误,就会出现4个新的错误:
util.lib(util.registration_protocol_win.obj) : error LNK2001: unresolved external symbol __imp_BuildSecurityDescriptorW
util.lib(util.registration_protocol_win.obj) : error LNK2001: unresolved external symbol ConvertStringSecurityDescriptorToSecurityDescriptorW
util.lib(util.registration_protocol_win.obj) : error LNK2001: unresolved external symbol __imp_BuildExplicitAccessWithNameW
base.lib(base.rand_util.obj) : error LNK2001: unresolved external symbol SystemFunction036通过使用Advapi32链接解决了这些错误
# Crashpad rules for Windows
win32 {
LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lbase
LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lclient
LIBS += -L$$PWD/Crashpad/Libraries/Windows/ -lutil
LIBS += -lAdvapi32
}可以在here中找到与Crashpad集成的示例Windows Qt应用程序。
https://stackoverflow.com/questions/62396117
复制相似问题