How to debug standalone file in Code::Blocks?

I guess you were trying to debug a standalone file (file not belonging to a project). Code::Blocks doesn't support debugging such files. Try including the file to be compiled as a part of an empty project or something.


In Code::Blocks, go into your Settings menu, then click Compiler. Make sure Global compiler settings is selected in the sidebar, then switch to the Toolchain executables tab. Your Debugger entry should say something like GDB/CDB debugger: default. If it does, OK out of this dialog.

Go back into the Settings menu and select Debugger. In the GDB/CDB debugger tree on the left, select Default. Make sure the Executable path textbox is set to your gdb.exe - in your case, the correct path will probably be something like C:\MinGW\bin\gdb.exe. Make sure the Debugger Type is set to GDB. Then hit OK.

Now your debugger (GDB) should be set up. Restart Code::Blocks if you like (I've had it glitch out before, crash, and lose whatever settings I changed since last restart), then go into the Debug menu and Start/Continue should be enabled.


remember about this: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks#Path_with_spaces

Breakpoints could not work if the path/folder you've placed your project contains spaces or other special characters. To be safe use English letters, digits and '_'.