如何获取gdb使用Eclipse CDT在Windows下(无法找到源代码) [英] How to get gdb working with Eclipse CDT under windows (fails to find source code)

查看:85
本文介绍了如何获取gdb使用Eclipse CDT在Windows下(无法找到源代码)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了cygwin(最新的1.7.xx?),然后安装了eclipse cdt(Juno)。



当我试图建立一个hello world项目时,尽管eclipse标识cygwin安装,它没有工作。



所以我手动添加c:\cygwin\bin到路径,发现所有的可执行文件cygwin,包括g ++,make ld等。



现在,eclipse可以构建项目,但是在调试时,gdb启动,找不到源代码。它声称找不到:



/cygdrive/c/users/me/workspace/test1/test1.cc

即使这正是它在哪里。就像cygwin的目录系统不工作一样。



我可以手动加载源代码:



c :\users\me\workspace\test1\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\再做一次。
如何指示eclipse / cygwin组合正确找到源代码?



或者,Mingw更容易吗?我遇到类似的问题eclipse看到mingw是有,但构建失败,因为它没有找到可执行文件。

解决方案

这是我如何使它的工作。


  1. 我转到窗口==>首选项==> C / C ++ ==>调试==>源查找路径

  2. 我添加路径映射:项目源

  3. 在左侧,我放置Cygwin期望的路径,即\home\MyName\projects,右侧我放了Windows路径,即C:\cygwin\home\MyName\projects

它找到源文件很好。


I installed cygwin (the latest 1.7.xx?), and then installed eclipse cdt (Juno).

When I tried to build a hello world project, despite eclipse identifying that cygwin was installed, it didn't work.

So I manually added c:\cygwin\bin to the path, which found all the executables in cygwin, including g++, make ld, etc.

Now, eclipse can build the project, but when debugging, gdb starts up and can't find the source code. It claims that it can't find:

/cygdrive/c/users/me/workspace/test1/test1.cc . even though that's exactly where it is. It's as though cygwin's directory system doesn't work.

I can manually load the source from:

c:\users\me\workspace\test1\test1.cc

and the debugger works, but the next time I start a new project, I have to do it again. How do you instruct the eclipse/cygwin combo to correctly find source code?

Alternatively, is Mingw any easier? I have experienced similar problems with eclipse seeing that mingw is there, but build failing because it doesn't find the executable.

解决方案

Here is how I made it work.

  1. I goto Window ==> Preferences ==> C/C++ ==> Debug ==> Source Lookup Path
  2. I Add a Path Mapping: Project Source
  3. On the left side I put the path that Cygwin expects, i.e. \home\MyName\projects and on the right side I put the Windows path, i.e. C:\cygwin\home\MyName\projects

Then when I debug it finds the source file fine.

这篇关于如何获取gdb使用Eclipse CDT在Windows下(无法找到源代码)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆