简体   繁体   中英

Eclipse Neon for c++ gdb debugger not working

I have 32 bit Eclipse Neon for C/C++ and installed the basic packages and c++ compiler for 32 bit MinGW. Everything in Eclipse seems to work fine except the debugger. When I tried debugging a simple hello world program, this is what the debugger will show: 在此输入图像描述

The project's C/C++ settings->dialect is set to C++11. The debugger just seems to terminate after pressing debug. There is no thread tree and none of the step functions are active. I made sure the "Skip all breakpoints" is unchecked and there is one breakpoint in the image right next to the "cout". I have tried reinstalling both Eclipse and MinGW multiple times already and restarted my computer, but nothing seems to work.

EDIT: Here's a screenshot of the run configuration -> main tab for those who want it.

在此输入图像描述

EDIT 2: A little update, so I added the MinGW bin's file path to Eclipse's Window -> Preferences -> C/C++ -> Build -> Environment variables, and I finally got an error message. 在此输入图像描述 Also my setup is MinGW 32 bit with 64 bit Eclipse Neon C/C++. My professor along with most of my peers are using this setup and their debugger seem to be working fine, so it's definitely something on my part that's causing this error, but I don't know what.

Ok, so I don't exactly know what happened, but the debugger works now. I fiddled with the environment variables a bit, and it started working after that. I tried isolating the solution, so I reinstalled Eclipse to see what setting actually fixed the debugger, but after this reinstall the debugger just worked normally unlike the previous times.

For those who have this problem I have a few suggestions on trying to get it to work. All of the suggestions involve adding the MinGW bin path to some environment variable:

  1. Add the MinGW bin path to your Environment variables (the user one or system one or you could try both).
  2. Add the MinGW bin path to your Eclipse's build environment variables (Window -> Preferences -> C/C++ -> Build -> Environment)
  3. Add MinGW bin path to your Run Configurations Environment variables (Run -> Run Configurations -> Environment tab) if it's not already there.
  4. Add the GDB debugger path (should be something like this C:\\MinGW\\bin\\gdb.exe) to your Debug Configurations (Run -> Debug Configurations -> Debugger Tab and in there put the gdb path in GDB debugger).

I don't actually know if this was what fixed the problem. My debugger just started to work after I tried those things (not necessarily in the stated order).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM