11

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.

Here is a screenshot that indicates the problem

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

3
  • did you find out what the problem was?
    – Winter
    Commented Nov 12, 2012 at 20:54
  • I need to find an answer to this question as well.
    – yarun can
    Commented Feb 10, 2013 at 6:13
  • No, I still don't know what the solution is.
    – amarillion
    Commented Mar 25, 2013 at 20:10

3 Answers 3

7

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:\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)

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 !

1
  • 2
    Link-only answers are discouraged. The links may get relocated/deleted. Please edit the answer to include the actual steps as well (in addition to the link).
    – anishsane
    Commented Nov 25, 2014 at 5:07
0

in "Debug Configuration" (under debugger popup icon) in Debugger tab uncheck "stop on startup at", after this it will not stop on startup, but u can put breakpoint there if u like

0

Nothing works. No solution as above worked except below

I simply replaced gdb with msys gdb

ie. for example

current configuration

... Application Configuration .. Debug .. Debug

GDB Debugger gdb

to

GDB Debugger path to msys gdb (like for example c:\msys\bin\gdb.exe

Manu

1
  • Instead of copy/paste your other answer, why don't make it linked with the question and more explain why and how this fix the issue ?
    – Elikill58
    Commented Jan 27, 2022 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.