Debugging with Eclipse CDT and GDB: can't find source file

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 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.

以下是显示问题的屏幕截图

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


Here is your answer http://www.eclipse.org/forums/index.php/t/57027/

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.

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

Admin@bs11-01xp ~
$ mount
D:cygwinbin on /usr/bin type system (binmode)
D:cygwinlib 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)

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

/cygdrive/j 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 => [Edith] => 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 !


在调试器选项卡中的“调试配置”(在调试器弹出图标下)取消选中“在启动时停止”,之后它不会在启动时停止,但是如果你喜欢,你可以在那里放置断点

链接地址: http://www.djcxy.com/p/61668.html

上一篇: Eclipse中的java索引器CDT

下一篇: 使用Eclipse CDT和GDB进行调试:找不到源文件