Well, the title pretty much says it all. I start up Qt Creator, I create a new project and click the plain C++ option. It creates the following code in the main.cpp file:
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
I put a breakpoint on the line beginning with cout or return.
I set the project mode to debug.
I click the play button with the bug on it.
It doesn’t stop at the breakpoint.
If I do the exact same thing but having created a Qt GUI Application, it works.
Help’d be much appreciated.
Thank you.
Oh yeah, if it makes any difference, I’m using the latest version of Linux Mint and from what I can tell, GCC and GDB are installed.
Edit: Here is the:
Compile Output:
23:27:37: Running build steps for project untitled2...
23:27:37: Starting: "/usr/bin/qmake-qt4" '/home/jean-luc/Desktop/untitled folder/untitled2/untitled2.pro' -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug
23:27:37: The process "/usr/bin/qmake-qt4" exited normally.
23:27:37: Starting: "/usr/bin/make" -w
make: Entering directory `/home/jean-luc/Desktop/untitled folder/untitled2-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
g++ -c -pipe -g -Wall -W -DQT_WEBKIT -I/usr/share/qt4/mkspecs/linux-g++ -I../untitled2 -I../untitled2 -I. -o main.o ../untitled2/main.cpp
g++ -o untitled2 main.o
{ test -n "" && DESTDIR="" || DESTDIR=.; } && test $(gdb --version | sed -e 's,[^0-9]\+\([0-9]\)\.\([0-9]\).*,\1\2,;q') -gt 72 && gdb --nx --batch --quiet -ex 'set confirm off' -ex "save gdb-index $DESTDIR" -ex quit 'untitled2' && test -f untitled2.gdb-index && objcopy --add-section '.gdb_index=untitled2.gdb-index' --set-section-flags '.gdb_index=readonly' 'untitled2' 'untitled2' && rm -f untitled2.gdb-index || true
make: Leaving directory `/home/jean-luc/Desktop/untitled folder/untitled2-build-desktop-Qt_4_8_1_in_PATH__System__Debug'
23:27:38: The process "/usr/bin/make" exited normally.
Application Output:
Debugging starts
Debugging has finished
Even though this is already a few days old, I’d like to add this resolution, as the problem described occasionally happens with Qt and Creator: Qt Creator has the nasty habit to suggest having the release and the debug objects in the same folder. So if you compile a release build, then decide to debug your program and make a debug build, it will link a debug application with release objects.
These objects cannot have a breakpoint set into. You need to clean the project completely, call qmake and make all in debug mode. Then you should be able to set breakpoints properly.