环境
- Windows 10 x64
- Visual Studio 2017
- Qt 5.11
异常
Qt Debug 时提示异常:
qt not in executable format. file format not recognized

原因
编译器(Compiler)使用了 64 位版本的 MSVC,调试器(Debugger)却使用了 32 位的 MinGW 的 GDB,从而 GDB 不能调试 64 位程序而报错。
解决
- 在 Qt 的
工具-选项-构建和运行-Debuggers选择 CDB(Debugging Tools for Windows), - 不能自动检测到则手动添加,如:
C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe, - 没有 cdb 则下载:Windows Driver Kit (WDK)(下载装好后重启 Qt 一般就可以自动检测到)
本文介绍在Windows10环境下使用VisualStudio2017和Qt5.11进行QtDebug时遇到的一个常见错误:“qtnotinexecutableformat.fileformatnotrecognized”。此错误源于编译器使用64位MSVC而调试器使用32位MinGW GDB。文章提供了解决方案,包括更换调试器为CDB并指明路径。
175





