为什么我的断点在 Qt Creator 中不起作用

发布于 2024-09-05 00:13:05 字数 115 浏览 5 评论 0原文

Qt Creator 可以完美地构建和运行我的项目,但它会直接跳过我设置的任何断点。我找不到任何选项来解决此问题,并且希望得到一些帮助。

编辑:SDK是在调试模式下构建的,并且项目构建配置设置为调试。

Qt creator can build and run my projects perfectly, but it will skip straight over any breakpoints I set. I can't find any options to fix this, and I'd appreciate some help.

EDIT: The SDK is built in debug mode, and the project build configuration is set to debug.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

聆听风音 2024-09-12 00:13:05

如果这是 cmake 构建,则需要在设置项目之前设置构建类型,例如
在您的顶级 CMakeList.txt 中:

SET(CMAKE_BUILD_TYPE Debug)
project(mybuildtype)

正式地,您也可以在运行 cmake 时将其传递给“项目”部分中的 cmake: http://qt -project.org/forums/viewthread/12694,因此使用 -DCMAKE_BUILD_TYPE=Debug 标志,但这似乎不再起作用......
如果您希望标志正常工作,则需要在设置项目之前对其进行测试,请参阅 http:// /www.cmake.org/pipermail/cmake/2008-September/023808.html

If this is a cmake build, you need to set the build type before setting the project, so eg
in your top CMakeList.txt:

SET(CMAKE_BUILD_TYPE Debug)
project(mybuildtype)

Officially, you can pass this also to cmake in Projects section when running cmake: http://qt-project.org/forums/viewthread/12694, so with -DCMAKE_BUILD_TYPE=Debug flag, but this does not longer seem to work...
If you want a flag working, you need to test on it before setting the project, see http://www.cmake.org/pipermail/cmake/2008-September/023808.html

我三岁 2024-09-12 00:13:05

Qt Creator 有两种运行应用程序的模式:“运行”和“调试”。我想您可能对它们的含义感到困惑:

  • 运行:启动程序,与双击可执行文件完全相同。
  • 调试:启动调试器,将其附加到可执行文件,然后通过调试器运行可执行文件。这记录了程序的所有步骤(函数调用等),包括断点。

简而言之:当您需要在程序执行期间计算内部值和/或设置断点时,请使用调试。对于其他任何事情,只需运行它即可,这要快得多。

Qt Creator has two modes of running your app: "run" and "debug". I think you may be confused as to what they mean:

  • Run: launch the program, exactly the same as double-clicking on the executable.
  • Debug: launch the debugger, attach it to the executable, and run the executable through the debugger. This records all steps (function calls etc.) your program has, including breakpoints.

In short: when you need to figure out an internal value during program execution and/or have set breakpoints, use Debug. For anything else, just run it, which is a lot faster.

涫野音 2024-09-12 00:13:05

我希望这能帮助有同样问题的人。
即使我将其设置为调试模式,但输出文件也放在发布文件夹中,当我查看我的 .pro 文件时,我发现了这一行

CONFIG += qt warn_on release rtti exceptions

然后我删除了“发布”,然后它就工作了。
希望这会有所帮助。

I hope this will help someone who has the same problem.
Even I set it debug mode, but the output files was put on release folder, when I looked at my .pro file, I found this line

CONFIG += qt warn_on release rtti exceptions

Then I remove "release", then it worked.
Hope this will help.

如何视而不见 2024-09-12 00:13:05

您需要在 .pro 文件中添加下一行:

CONFIG     += debug

并且可能您需要删除此行:

CONFIG     += release

You need to add in .pro file next line:

CONFIG     += debug

And may be you need to delete this:

CONFIG     += release
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文