问题描述
我在 mac 上使用 c /eclipse kepler,我无法调试任何项目.错误是启动命令时出错:gdb --version"除此之外,我可以使用其他库构建和运行我的代码.
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.
我搜索了一个与我的问题类似的网站:debugger for c eclipse 给出以下错误.'launching program name' 遇到了...启动命令时出错:gdb --version
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
但是如果我使用的是 mac,我应该改变什么?
but what should i change if i am using a mac?
推荐答案
您可以通过指定 gdb 的完整路径来解决此问题.您可以为每个调试配置单独执行此操作,也可以在 c/c > gdb 下的首选项中设置默认 gdb 位置.例如,如果您通过 homebrew 安装 gdb,那么它可能位于 /usr/local/bin 下:
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:
我仍然不知道为什么 eclipse 无法找到 gdb,即使它在我的路径上.我猜它不使用我的 .bash_profile 或我的 .bashrc?您可以尝试将 gdb 符号链接到 /usr/bin.也许 eclipse 会看那里.
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.
我尝试了符号链接的想法,现在 eclipse 可以调试了,但是这样做时它会莫名其妙地崩溃!所以,我猜...不要那样做?
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?