1

I am working on C++ and I created a file and put a breakpoint, but when I start debugging, it opens up a terminal, and suddenly it closes it. I am not sure what is wrong with debugging. If I run the project, it is working fine, it will ask for user input as per my program, but debugging is not working. Kindly help me. I have followed some questions but this issue is nowhere

6
  • 1
    Sadly IDE-problem questions like this are really hard to answer without access to the computer running the IDE. If the program isn't exiting ahead of the breakpoint (put a breakpoint right at the start of main and pray that you don't have an initialization failure BEFORE main is reached), something is not configured correctly, and the only way for us to help you is for you to add the bit of broken configuration to the question for us to examine. And the only way to know what in the configuration is broken so you can add it to the question is often to have already solved the problem. Commented Apr 9, 2024 at 21:19
  • Recommendation: Do what you can to eliminate the possibility of a bug in the code by attempting to isolate the problem. Because it's damn easy to do, try to reproduce with a Hello World. If you can't step through all one line of Hello World, your configuration is most definitely hosed. In that case see if you can find a debug diagnostic terminal or log file. There will be on e somewhere, but not being a Code::Blocks user, I have no idea where to look. Commented Apr 9, 2024 at 21:25
  • If you can debug Hello World, the debugger's fine, and you need to build a minimal reproducible example (MRE) to isolate the problem in the code. If after isolating the problem in the code you're still stuck, add the MRE to the question. Commented Apr 9, 2024 at 21:25
  • simple hello world is not working. Commented Apr 10, 2024 at 6:14
  • @user4581301 I am using windows 11 Commented Apr 10, 2024 at 8:16

1 Answer 1

1

If anyone facing this issue. I have found a workaround, instead of using codeblock gdb for debugging use msys64 ming64 gdb. Go to setting -> debugger-> select GDB/CDB debugger->default. In the executable path: give the path of msys64 gdb(C:\msys64\mingw64\bin\gdb). I am still not sure why it is not working with inbuilt gdb of codeblocks.

Sign up to request clarification or add additional context in comments.

2 Comments

As an addendum, consider replacing the entirety of the build tools shipped with Code::Blocks. When GCC 13 and MSYS's excellent library support is available, why use GCC 8 and have to build all of the common support tools yourself?
yeah, I setup it for basic programming only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.