简体   繁体   English

如何让 Qt Creator 与 CDB 一起工作?

[英]How to get Qt Creator to work with CDB?

I'm using Qt Creator 2.01 32-bit with Qt 4.7.1 on Windows 7 64-bit.我在 Windows 7 64 位上使用Qt Creator 2.01 32 位和 Qt 4.7.1。 I compiled my Qt library using Microsoft Visual C++ 2010. Now I want to use CDB with Qt Creator (or GDB if that works, or whatever is the best option).我使用 Microsoft Visual C++ 2010 编译了我的 Qt 库。现在我想将CDB与 Qt Creator(或GDB,如果可行,或任何最佳选择)一起使用。 What exactly do I need to do to be able to debug with CDB (so I can set break points and see symbols)?我究竟需要做什么才能使用 CDB 进行调试(以便我可以设置断点并查看符号)?

Please don't just point me to http://qt-project.org/doc/qtcreator-2.8/creator-debugger-engines.html because I've been there and I'm still missing something.请不要只是将我指向http://qt-project.org/doc/qtcreator-2.8/creator-debugger-engines.html因为我去过那里但我仍然缺少一些东西。 I have Windows SDK installed with debugger tools (but I think it's the 64-bit version).我安装了带有调试器工具的 Windows SDK(但我认为它是 64 位版本)。 What I'm looking for is what options I need to set in Qt Creator to get this all setup.我正在寻找的是我需要在 Qt Creator 中设置哪些选项才能完成所有设置。

EDIT: Also I should clarify I think the debugger kind of works because I can hit F5 and my application starts and then I can select "debug->interrupt" and it seems to stop.编辑:另外我应该澄清我认为调试器可以工作,因为我可以按 F5 并启动我的应用程序,然后我可以选择“调试->中断”,它似乎停止了。 But in the call stack the function names look mangled and breakpoints set in the editor don't break.但是在调用堆栈中,函数名称看起来很混乱,并且在编辑器中设置的断点不会中断。 If I hit F10 , then it steps through the code in what looks like assembly.如果我点击F10 ,那么它会以程序集的形式逐步执行代码。 Maybe it's because I'm building a DLL and I set F5 to run the parent application which in turn loads and calls my DLL.也许是因为我正在构建一个 DLL 并且我设置了F5来运行父应用程序,该父应用程序反过来加载并调用我的 DLL。

Since your Qt is compiled with MSVC the best option is indeed CDB (for GDB you would need, for example, a MinGW compiled version).由于您的 Qt 是使用 MSVC 编译的,因此最佳选择确实是 CDB(例如,对于 GDB,您需要一个 MinGW 编译版本)。

Debugging should be out of the box.调试应该是开箱即用的。 One first point I could think is whether for some reason Qt Creator doesn't see your debugging tools for Windows.我能想到的第一点是 Qt Creator 是否由于某种原因看不到您的 Windows 调试工具。 Have you made sure that the path (and the version) for it is correctly specified in the CDB options page?您是否确保在 CDB 选项页面中正确指定了它的路径(和版本)?

Also, have you considered switching to Qt Creator 2.1 (it has a lot of improvements in the area)?另外,您是否考虑过切换到Qt Creator 2.1 (它在这方面有很多改进)? Or even better, a self-compiled version of the 2.2 branch , which includes a total refactoring of the CDB engine.或者更好的是2.2 分支的自编译版本,其中包括对 CDB 引擎的全面重构。

Install the microsoft SDK for windows 7 (version 7.1 or later) and check the box for debugging tools for windows.安装 microsoft SDK for windows 7(版本 7.1 或更高版本)并选中 windows 调试工具框。 Make sure you selected the msvc version of Qt, not mingw.确保您选择了 Qt 的 msvc 版本,而不是 mingw。 As long as you have the debugging tools for windows installed the next time you go to debug your application it will prompt you to set up symbol server- click yes and then you are all set.只要您在下次调试应用程序时安装了 windows 的调试工具,它就会提示您设置符号服务器-单击是,然后就全部设置好了。

  1. tools工具
  2. options...选项...
  3. kits套件
  4. choose your kit选择您的套件
  5. select debugger选择调试器

在此处输入图片说明

Just in case this helps anyone, I'm using Qt Creator 2.3.1 based on Qt 4.7.4 under Windows Vista.以防万一这对任何人有帮助,我在 Windows Vista 下使用基于Qt 4.7.4 Qt Creator 2.3.1

I've been having awful problems getting it to debug.我在调试它时遇到了可怕的问题。 It wouldn't build into the project's /debug folder, so when I ran Debug (F5) it failed and said no such app or directory.它不会构建到项目的 /debug 文件夹中,所以当我运行 Debug (F5) 时它失败了,并说没有这样的应用程序或目录。 Turns out changing the Build Settings and creating a new debug build but specifying the /release folder (where it was creating my app) works fine.原来更改构建设置并创建一个新的调试构建,但指定 /release 文件夹(它在那里创建我的应用程序)工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM