Mac C++/eclipse cannot debug: Error while launching command: gdb --version
Solution 1
You can fix this by specifying the full path to gdb. You can do this separately for each debug configuration, and you can also set the default gdb location in the preferences under C/C++ > GDB. For example, if you installed gdb via Homebrew, then it's probably located under /usr/local/bin
:
And here's a screenshot of the Preferences:
I still don't know why Eclipse can't find GDB even though it is on my path. I guess it doesn't use my .bash_profile
or my .bashrc
? You could try symlinking gdb into /usr/bin
. Maybe Eclipse will look there.
Edit: I tried the symbolic link idea and now Eclipse can debug, but it crashes inexplicably while doing so! So, I guess... don't do that?
Solution 2
This guide from a UC Irvine Computer Science professor's page is a very well-written, detailed, and Mac-specfic description of all the steps involved in installing GDB, creating a certificate, signing GDB using that certificate, and finally configuring Eclipse. I was found this very helpful as someone unfamiliar with each of these steps.
Solution 3
I had the same problem. I solved it by:
- Install a gdb - ( I used 7.8.1) - compile and install it. It got installed in
usr/local/bin
- Codesigning certificate
- Open eclipse executable using
sudo
. Otherwise I still get the error.
I am on OS X. Hope this helps.
Solution 4
I had this error too now, and spent more than an hour looking for it. In my case, the path was correct, and eclipse seemed to fail to start "any" executable as debugger. (I tested with gksudo cat, but it clearly never got to effectively running it).
The final reason was that I had put in my eclipse.ini -Xms1G and -Xmx1G. It seemed to already use the full memory for the indexer, and trying to allocate some more memory to start the debugger failed with an "unkown" error. Removing the memory limitations fixed the issue.
Hope this helps someone
Related videos on Youtube
user3000888
Updated on May 31, 2020Comments
-
user3000888 almost 4 years
I am using c++/eclipse kepler on mac, and I cannot debug any project. The error is "Error while launching command: gdb --version" Besides that, I can build and run my code using other libraries.
I searched a site that is similar to my problem: Debugger for C++ eclipse gives the following error. 'Launching program name' has encountered a ... Error while launching command: gdb --version
But what should I change if I am using a mac?
-
mostafa tourad over 10 yearsDo you actually have
gdb
installed? Rungdb --version
within your terminal. -
dbrank0 over 10 yearsIn my experience this is eclipse bug related to system PATH. Check if it's valid or if you can simplify it.
-
user3000888 over 10 yearsYes, I have gdb, instead it changes its name to ggdb, but I still cannot debug
-
Neil Traft over 10 yearsAre you on OS X Mavericks? Also, how do you know it's changing the name? What do you mean by that?
-
-
MGR almost 7 yearsI found it working when the environment variable settings in eclipse was updated with proper path to gdb.exe.
-
nyg over 5 yearsI can't believe this error can comme from a performance issue... I'm running Eclipse inside a VM, and after reducing the number of CPUs the VM can use, Eclipse could not start any debugger... I've reverted the change and the debugger starts fine now... thanks a lot!