使用Eclipse CDT和GDB进行调试:找不到源文件 [英] Debugging with Eclipse CDT and GDB: can't find source file

查看:325
本文介绍了使用Eclipse CDT和GDB进行调试:找不到源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试从Eclipse CDT使用GDB调试应用程序时,出现以下错误:

When I try to debug my application using GDB from eclipse CDT, I get the following error:

 Can't find a source file at "../mingw/main.c"
 Locate the file or edit the source lookup path to include its location.

Eclipse正在寻找../mingw/main.c中的源文件位置,但是它应该在/edit/src/main.c中。如下面的屏幕快照所示,edit / src是源查找路径的一部分。为什么要浏览../mingw?我找不到任何使它看起来在那里的配置设置。

Eclipse is looking for the source file location at ../mingw/main.c, but it should be in /edit/src/main.c. As you can see in the screenshot below, edit/src is part of the source lookup path. Why is looking in ../mingw? I can't find any configuration setting that makes it look there.

我正在使用Eclipse Juno,CDT 8.1,Windows 7 64bit

I'm using eclipse Juno, CDT 8.1, Windows 7 64bit

推荐答案

这是您的答案 http://www.eclipse.org/forums/index.php/t/57027/

如果您在Windows下工作,请您设置所需的映射?
也许是Eclipse找不到源,因为缺少映射到项目/工作区所在的(cygwin-)驱动器
的映射。

If you're working under Windows, have you set the required mappings? Maybe Eclipse couldn't find the Source because of the missing mapping to the (cygwin-)drive where your projects/workspaces are.

当您启动Cygwin时,输入 mount并查找您具有的映射:
它们可能看起来像这样:

When you start Cygwin, enter "mount" and look for the mapping you have: They may look like this:

Admin@bs11-01xp ~
$ mount
D:\cygwin\bin on /usr/bin type system (binmode)
D:\cygwin\lib on /usr/lib type system (binmode)
D:\cygwin on / type system (binmode)
c: on /cygdrive/c type system (binmode,noumount)
d: on /cygdrive/d type system (binmode,noumount)
e: on /cygdrive/e type system (binmode,noumount)
j: on /cygdrive/j type system (binmode,noumount)
n: on /cygdrive/n type system (binmode,noumount)
u: on /cygdrive/u type system (binmode,noumount)
w: on /cygdrive/w type system (binmode,noumount)
x: on /cygdrive/x type system (binmode,noumount)
y: on /cygdrive/y type system (binmode,noumount)
z: on /cygdrive/z type system (binmode,noumount)

我的项目全部在 J:\Projects ,因此我的映射需要以
的形式在Eclipse中显示为:

My Projects ara all under J:\Projects, so my mapping needs to be present in Eclipse as:

/cygdrive/j j:/

打开Eclipse,然后单击

-Windows => Preferences ... = > C / C ++ =>调试=>通用源查找
路径

-添加新的路径映射:单击[添加] =>路径映射=> [确定]

-选择新的映射=> [Edith] =>更改映射名称 Project
Source => [Add]

-将 Compilation path设置为Source(示例cygwin! ) / cygdrive / j
(不带引号!)

-设置本地文件系统路径 tho J:\(不带引号!)

Open Eclipse and then click
- Windows => Preferences... => C/C++ => Debug =>Common Source Lookup Path
- Add a new Path Mapping: click [Add] => Path Mapping => [OK]
- Select the new Mapping => => change Name of Mapping "Project Source" => [Add]
- set "Compilation path" to the Source (Sample cygwin!) "/cygdrive/j" (without the quotes!)
- set"Local file system path" tho "J:\" (without the quotes!)

现在您已经准备好再次尝试....祝您好运!

Now you are ready ti give it another try.... good luck !

这篇关于使用Eclipse CDT和GDB进行调试:找不到源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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