Author Topic: Can't Get Debugger to Work  (Read 482 times)

Offline JoeH

  • Single posting newcomer
  • *
  • Posts: 7
Can't Get Debugger to Work
« on: October 10, 2025, 06:14:06 am »
I have tried several times to use the debugging capability of Code::Blocks, but I cannot get it to work.  I am using version 25.03 on Windows 11.  Most recently, I tried to follow a YouTube "How To" video with no better luck.  The small C language test program will compile (Debug Build Target selected) and execute successfully.  However, when I try to run the debugger, it appears that Code::Blocks tries to rebuild the code and fails.  Is there something else besides selecting the Debug build target that must be done before the debugger will work?

Joe

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6103
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Can't Get Debugger to Work
« Reply #1 on: October 10, 2025, 07:00:37 am »
Quote
when I try to run the debugger, it appears that Code::Blocks tries to rebuild the code and fails

I'm not sure how you configure the debugger, and I don't know what is the exactly error, can you show us some log message about debugger? It is normally in the "Debugger" output panel in the bottom of the IDE window.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline blauzahn

  • Almost regular
  • **
  • Posts: 215
Re: Can't Get Debugger to Work
« Reply #2 on: October 10, 2025, 07:16:35 pm »
With compiled languages like C a debugger can only start after the compiler and linker suceeded without error and were able to create an executable programm to run.

As long as the compiler tries to help you and tell you where you have made a mistake, it is pointless to proceed.
Trying to smuggle defective code past the compiler is also a bad idea. Nevertheless, in case you enabled the warning -Werror you
might want to disable ist.

Please do yourself a favor and get a decent programming book. This forum is for using cb, not a helper forum for programming newbies.

Offline blauzahn

  • Almost regular
  • **
  • Posts: 215
Re: Can't Get Debugger to Work
« Reply #3 on: October 10, 2025, 08:42:08 pm »
I somehow overlooked, that you could actually execute the code with the non-debug Target. Sorry.

Apart from the advice from @ollydbg to watch the log:

Since compiling the Debug Build target fails, please compare the settings in project|Build Targets with the target that builds sucessfully.

Inspecting the commandline might also give insights: please change settings|compiler|other settings|Compiler logging: temporarily to "full command line".

I tried cb on Windows briefly many years ago. No idea whether Windows 11 may pose a problem.

Can you compile, link, run and debug a "Hello, world"! in debug-mode? As a program with no additional dependencies. Preferably at first without cb, just from the commandline. Only then in a minimal cb console project without any extras.


« Last Edit: October 10, 2025, 08:44:03 pm by blauzahn »