C++ 如何在 Qt Creator 中配置 CDB?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9975949/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 13:28:04  来源:igfitidea点击:

How to configure CDB in Qt Creator?

c++cqtqt-creator

提问by Martin

The question hereis the same as mine but the solution there is not working for me. I am using QtCreator 2.4.1 on Windows 7. When i try to debug a simple hello world app the message displayed is: "The preferred debugger engine for debugging binaries of type 'x86-windows-msvc2010-pe-32bit' is not available....Details: There is no CDB binary available for binaries in format 'x86-windows-msvc2010-pe-32bit"

这里的问题与我的相同,但那里的解决方案对我不起作用。我在 Windows 7 上使用 QtCreator 2.4.1。当我尝试调试一个简单的 hello world 应用程序时,显示的消息是:“用于调试‘x86-windows-msvc2010-pe-32bit’类型二进制文件的首选调试器引擎不可用....详细信息:没有可用于格式为“x86-windows-msvc2010-pe-32bit”的二进制文件的 CDB 二进制文件

When i found that cdb.exe was not on my system i had Windows SDK installed with debugger tools and the current location of cdb.exe is "C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x86\cdb.exe" and "C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x64\cdb.exe",

当我发现 cdb.exe 不在我的系统上时,我安装了带有调试器工具的 Windows SDK,并且 cdb.exe 的当前位置是“C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x86\cdb。 exe”和“C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x64\cdb.exe”,

In the CDB tab i configured symbol server as well as the path of CDB.exe, but in vain!

在 CDB 选项卡中,我配置了符号服务器以及 CDB.exe 的路径,但徒劳无功!

QtCreator->Tools->options->Debugger->CDB Tab->has the following fields:
Additional arguments
use CDB console
Symbol Paths
Source Paths
Correct breakpoint location etc...

QtCreator->Tools->options->Debugger->CDB Tab->具有以下字段:
附加参数
使用CDB控制台
符号路径
源路径
正确断点位置等...

Can somebody kindly explain in detail what these mean and what values are expected here. Has anybody successfully debugged any applicaiton using Qt Creator.

有人可以详细解释这些含义以及此处期望的值。有没有人使用 Qt Creator 成功调试过任何应用程序。



Please refer this link:
http://qt-project.org/forums/viewthread/16018/

请参考此链接:http:
//qt-project.org/forums/viewthread/16018/

回答by Colby Boles

I was having the same problems too, and finally figured out how to solve this. Styne666 gave me a hint. Do the following:

我也遇到了同样的问题,终于想出了如何解决这个问题。Styne666给了我一个提示。请执行下列操作:

  1. Tools
  2. Options...
  3. Build & Run
  4. Tool Chains
  5. Use the "Clone" button to make a copy of each of the auto-detected MSVC items
  6. In each of the cloned items, you can specify the debugger in the "Debugger" field (e.g. C:\Program Files\Windows Kits\8.0\Debuggers\x64\cdb.exe)
  7. After this everything seems to work...
  1. 工具
  2. 选项...
  3. 构建和运行
  4. 工具链
  5. 使用“克隆”按钮复制每个自动检测到的 MSVC 项目
  6. 在每个克隆项中,您可以在“调试器”字段中指定调试器(例如 C:\Program Files\Windows Kits\8.0\Debuggers\x64\cdb.exe)
  7. 在此之后,一切似乎都有效......

I should further mention that if you are running a 64-bit version of Windows and a 32-bit version of Qt Creator like I am, you need to make sure that you are pointing to the 32-bit versions of cdb (of which there are x86 and x64 targetversions). So for the 32-bit target builds I run this:

我应该进一步提到,如果您像我一样运行 64 位版本的 Windows 和 32 位版本的 Qt Creator,您需要确保指向 32 位版本的 cdb(其中有是 x86 和 x64目标版本)。因此,对于 32 位目标版本,我运行以下命令:

C:\Program Files (x86)\Windows Kits.0\Debuggers\x86\cdb.exe

And for x64 builds I run this:

对于 x64 构建,我运行这个:

C:\Program Files (x86)\Windows Kits.0\Debuggers\x64\cdb.exe

The tricky part is that it is somewhat difficult to get Microsoft to install the 32-bit version of the debugging tools on your 64-bit machine. A co-worker tried to do so recently and said that he needed to install the Windows 8 tools in order to have the option to do that - the Windows 7 versions would not let you.

棘手的部分是让 Microsoft 在您的 64 位机器上安装 32 位版本的调试工具有些困难。一位同事最近尝试这样做,并说他需要安装 Windows 8 工具才能选择这样做 - Windows 7 版本不会让你这样做。

回答by mBardos

Took me some time to figure out this with Qt Creator 2.6.0 (on Windows 7), so here it is:

我花了一些时间用 Qt Creator 2.6.0(在 Windows 7 上)弄清楚这一点,所以这里是:

  • Tools, Options...
  • Build & Run, Kits tab, select "Desktop (default)" (under Manual)
  • Click the Manage button and select Edit on the right side of "Debugger:"
  • Engine: CDB, Binary: C:\Program Files\Debugging Tools for Windows (x64)\cdb.exe
  • 工具、选项...
  • 构建和运行,套件选项卡,选择“桌面(默认)”(在手动下)
  • 单击“管理”按钮并选择“调试器”右侧的编辑:
  • 引擎:CDB,二进制:C:\Program Files\Debugging Tools for Windows (x64)\cdb.exe

回答by Darien Pardinas

Depending on the version of Visual Studio you have installed you can find the CDB.exe in different locations. Check if it is available in your system by searching in C:\ drive.

根据您安装的 Visual Studio 版本,您可以在不同位置找到 CDB.exe。通过在 C:\ 驱动器中搜索来检查它是否在您的系统中可用。

In my case I have Windows 7 (x64) with Visual Studio 2012 Express and Visual Studio 2013 installed and I had to install Microsoft Windows SDK for Windows 7 available herein order to have CDB.exe in my system. After the install, QT Creator was able to detect CDB.exe in this location: C:\Program Files\Debugging Tools for Windows (x64)\cdb.exe.

就我而言,我安装了带有 Visual Studio 2012 Express 和 Visual Studio 2013 的 Windows 7 (x64),我必须在此处安装适用于 Windows 7 的 Microsoft Windows SDK ,以便在我的系统中安装 CDB.exe。安装后,QT Creator 能够在以下位置检测到 CDB.exe:C:\Program Files\Debugging Tools for Windows (x64)\cdb.exe。

The only thing you need from the SDK is the Common Utilities | Debugging Tools For Windows.

SDK 中唯一需要的是 Common Utilities | Windows 调试工具。

回答by user2922038

I try, first install Visual Studio 2010, After, then in CDB Binaryputs: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger\x86\mpishim100.exe, or only download this file!..

我试试,先安装Visual Studio 2010,之后,然后在CDB Binaryputs: C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Remote Debugger\x86\mpishim100.exe,或者只下载这个文件!..

Its the solution!!! In windows 8 64 bits!!

它的解决方案!!!在 Windows 8 64 位中!!

回答by Samuel Harmer

It sounds like what I encountered on OSX with the gdb. If so, the solution for me was (within Qt Creator):

这听起来像我在 OSX 上遇到的 gdb。如果是这样,我的解决方案是(在 Qt Creator 中):

  1. Tools
  2. Options...
  3. Build & Run
  4. Qt Versions
  5. Select the corresponding version
  6. Expand the Details panel
  7. Press the Build button which is inline with "GDB Helper"
  1. 工具
  2. 选项...
  3. 构建和运行
  4. Qt 版本
  5. 选择对应版本
  6. 展开详细信息面板
  7. 按与“GDB Helper”内联的Build按钮

In your case, the text would likely be different (CDB instead of GDB perhaps) but the same steps may apply.

在您的情况下,文本可能会有所不同(可能是 CDB 而不是 GDB),但可能适用相同的步骤。

回答by Vinoj John Hosan

  1. Re install windows sdk for respective windows
  2. Correctly configure release/debug dll correctly for any external libraries
  1. 为相应的窗口重新安装 windows sdk
  2. 为任何外部库正确配置发布/调试 dll