Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running debug mode in Qt Creator

Tags:

qt

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?

like image 435
Karnivaurus Avatar asked Oct 24 '14 13:10

Karnivaurus


People also ask

What is Qt debug information files?

Debug information files allow Sentry to extract stack traces and provide more information about crash reports for most compiled platforms. Information stored in debug files includes original function names, paths to source files and line numbers, source code context, or the placement of variables in memory.


2 Answers

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

Animation of the Run menu and the Projects view

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.

like image 83
qubodup Avatar answered Sep 18 '22 07:09

qubodup


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.

like image 36
Jaguardo Avatar answered Sep 21 '22 07:09

Jaguardo