Why won't my breakpoints work in Qt Creator
Solution 1
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.
Solution 2
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
Solution 3
You need to add in .pro file next line:
CONFIG += debug
And may be you need to delete this:
CONFIG += release
Solution 4
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.
CoutPotato
Updated on July 09, 2022Comments
-
CoutPotato almost 2 years
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.