To generate the CodeBlocks project from any CMake project.
cmake -G"CodeBlocks - Unix Makefiles"
A top-level folder is created relative to the subdirectory containing the CMakeFileLists.txt.
I start CMake-Gui and add the following parameters to enable debugging symbols in the executable.
Then in CMake-GUI add the following parameter.
CMAKE_CXX_FLAGS_DEBUG_INIT = "g"
The new entry is type string and the “g” to generate debug symbols option is enclosed in double-quotes.
Click the Configure button followed by the Generate button on the CMake-GUI application. After the processes are successful, traverse to the location where the Makefile was created and issue the following command.
We now have an executable file with the symbols included which is ready for debugging. The CodeBlocks debugger has issues with this approach but there is a GUI for debugging that saves the day.
KDbg should be downloaded and created using CMake. After the interactive debug tool is installed load the executable program into the debugger. Set a breakpoint and click the run option. Program execution halts and the designated breakpoint.
We are now set to debug our application.
Mr. Arch Brooks, Software Engineer, Brooks Computing Systems, LLC authored this article.