How to compile with -ggdb3
Solved
General and Desktop
-
I have a Qt application that runs on a headless Raspberry Pi. The build environment was built via:
cd <project_dir> mkdir build cd build /usr/lib/qt6/bin/qt-cmake ../src/
and I compile with
cmake -build . -j 4
Q: How can I compile it with gdb fully enabled, ie, with -ggdb3?
-
First step is to make debug build:
/usr/lib/qt6/bin/qt-cmake -DCMAKE_BUILD_TYPE=Debug ../src/
If you are using a GCC tool chain then this will build your executables with debug symbols that
gdb
can work with using the-g
option:make VERBOSE=1 ... /usr/bin/c++ -g ...
If you must force the
-ggdb
optionor the-gn
variations then you'll likely have to do that that manually in the CFLAGS and CXXFLAGS. -