Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why won't my breakpoints work in Qt Creator

Tags:

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.

like image 941
CoutPotato Avatar asked Jun 08 '10 19:06

CoutPotato


People also ask

Why are my breakpoints not hitting?

If a source file has changed and the source no longer matches the code you're debugging, the debugger won't set breakpoints in the code by default. Normally, this problem happens when a source file is changed, but the source code wasn't rebuilt. To fix this issue, rebuild the project.

How do you set a breakpoint in Qt?

Add a breakpoint at the end of the startNewGame() function, and click (Continue) to hit the breakpoint. To execute JavaScript commands in the current context, open the QML Debugger Console. To remove a breakpoint, right-click it and select Delete Breakpoint. In the Locals view, explore the object structure at runtime.

How do I activate breakpoints?

To set a breakpoint in source code: Click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint.


1 Answers

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

like image 137
Benn Malengier Avatar answered Oct 24 '22 21:10

Benn Malengier