简体   繁体   中英

Running debug mode in Qt Creator

I am trying to compile some demo code (specifically, the pcl_visualizer demo that comes with the Point Cloud library). When running debug by clicking the green arrow with the magnifying class, I get the following errors:

This does not seem to be a "Debug" build.
Setting breakpoints by file name and line number may fail.

Section .debug_info: Not found.
Section .debug_abbrev: Not found.
Section .debug_line: Not found.
Section .debug_str: Not found.
Section .debug_loc: Not found.
Section .debug_range: Not found.
Section .gdb_index: Not found.
Section .note.gnu.build-id: Found.
Section .gnu.hash: Found.
Section .gnu_debuglink: Not found.

Furthermore, none of the breakpoints I have inserted are breaking the program, and they all have little hourglasses hovering over.

In Projects , the Debug mode is selected in Build Settings .

Why does my code not seem to be debugging correctly?

Some projects automatically build debug mode and allow to run it individually. You can then pick it in the bottom left Run selection menu.

“运行”菜单和“项目”视图的动画

Other projects require you to specifically do a debug build.

For example: Kdenlive requires you to run CMake again with the following parameter added:

-DCMAKE_BUILD_TYPE=Debug

You can re-run CMake in the Projects view.

For newer versions of QT: Go to "Projects" in the top left of the screen, an icon with a wrench that turns green when you select it.

If not already "clicked", click on "Build" under the named Kit (I have "desktop" as my kit). This should be immediately below "Build & Run" on the left side.

Under Build Settings at the top center, should have "Edit build configuration" with a drop down next to it. If you can select "Debug" from the drop down then do it, otherwise click "Add" in the drop down next to it and select "Debug".

Drop down some and see "Key" on the left side of a table of "Key"s with "Value"s, look farther right and see "Advanced" with a square, check the square to get the advanced Key-Value pairs.

Look for "CMAKE_BUILD_TYPE" and click "Edit" in the far right, change the drop down for the value matched to the key CMAKE_BUILD_TYPE to "debug".

Now in the bottom left, change the build configuration to "debug" and build... should work!

You may have to Clean the project and possibly clear cmake configuration under the Build tab.

Another cause for the "does not appear to be a debug build" message is running gdb using the cdb engine. to check go to tools->options->build and run->kits and select the kit you are using. next go to the debugger line, choose edit, and make sure you have the right engine for your debugger.

在 linux 上使用“Qt 维护工具”安装“Qt 调试信息文件”为我解决了这个问题

I've got the same message because the build type was set to release. On Qt Creator 3.3.0 on the bottom left, on top of the play symbol i have a pc icon with the build type. click on that icon and select debug. I needed to 'run qmake' too from the menu build.

For nasm users with QT5.9.1 and nasm 2.14 the problem will be gone by using: nasm -felf64 -FDwarf -g

I know it's not c/c++ related but works very well in QT

To change the Build Configuration in QT Creator :(at time of writing : 4.13.3)

Just make sure you have selected this as Debug so that it would then run in debug mode. 在此处输入图片说明

我设法通过在调试设置常规选项卡中取消选中“调试发布版本时发出警告”来解决这个问题,如文章中所述: http : //www.kdab.com/qt-on-android-episode-2/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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