How to get gdb working with Eclipse CDT under windows (fails to find source code)

前端 未结 5 2055
孤城傲影
孤城傲影 2021-02-04 10:03

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

相关标签:
5条回答
  • 2021-02-04 10:10

    Go to Windows->Preference->C/C++ -> Debug -> Source Lookup Path. Add following 'Path mapping'.

    \cygdrive\c -> c:\
    
    0 讨论(0)
  • 2021-02-04 10:14

    I use MinGW + CDT, and it is giving me great satisfaction. I installed it many times and never had any disagreement. No much to configure than what you did with cygwin. Download the Eclipse for C/C++ developers (probably what you did) to get CDT (MinGW Tool Chain -> gdb + gcc) directly operational. Set your \\MinGW\bin\ directory into your PATH and you should be good to go...

    Note : Like Cygwin, MinGW provides a Linux-like Shell.

    For MinGW-64, ready-made builds are a little bit more difficult to locate. See here.

    0 讨论(0)
  • 2021-02-04 10:26

    Although Above are given good answers but still it might not solve the problem sometimes phew!!!!

    Suppose you install Cygwin in C: but your eclipse workspace is in D: then there is a problem in your mounting

    all you should do is, open the cygwing shell & type "mount" to get the following :

      Ritvika@Ashutosh ~
      $ ls
    
      Ritvika@Ashutosh ~
      $ mount
      C:/cygwin64/bin on /usr/bin type ntfs (binary,auto)
      C:/cygwin64/lib on /usr/lib type ntfs (binary,auto)
      C:/cygwin64 on / type ntfs (binary,auto)
      C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto)
      D: on /cygdrive/d type ntfs (binary,posix=0,user,noumount,auto)
    
      Ritvika@Ashutosh ~
      $
    

    here my Projects are all under D:\ECWorkSpace, so my mapping needs to be present in Eclipse as: /cygdrive/d d:/

    Hence, now Armed with this knowledge do what PathM says

     1. goto Window ==> Preferences ==> C/C++ ==> Debug ==> Source Lookup Path
     2. Add a Path Mapping: Project Source
     3. On the left side put "cygdrive\d",  & on the right put : "D:\"
    

    This should work. ( It did for me :) ) You can Check this FAQ as well : https://wiki.eclipse.org/CDT/User/FAQ#I.27m_using_cygwin_and_when_launching_the_debugger.2C_it_complains_that_it_can.27t_find_the_source_file

    0 讨论(0)
  • 2021-02-04 10:27

    Look at set-up of "Common Source Lookup Path" here: http://wyding.blogspot.dk/2009/04/setup-cygwin-toolchain-in-eclipse-cdt.html

    0 讨论(0)
  • 2021-02-04 10:29

    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.

    0 讨论(0)
提交回复
热议问题