前面省略下载Eclipse和Cygwin的过程。

下面记录下解决调试报错的问题的过程。

当写好程序,进入Debug时,会出现以下错误提示:

[Windows]在Win7系统下搭建Eclipse+Cygwin开发环境

这时候点击“Edit Source Lookup Path”按钮,会出现以下画面:

[Windows]在Win7系统下搭建Eclipse+Cygwin开发环境

点击“Add”按钮,再选择下图中的“Path Mapping”选项。

[Windows]在Win7系统下搭建Eclipse+Cygwin开发环境

名字就命名为“Debug Mapping”,点击“Add”,依次填入以下信息:

Compilation path ——> /cygdrive/c

Local File System Path ——> C:\

来自Eclipse的Wiki,原址如下:http://wiki.eclipse.org/CDT/User/FAQ#Debugging_C.2FC.2B.2B_Projects

原文如下:

I'm using cygwin and when launching the debugger, it complains that it can't find the source file

You must provide a mapping from /cygdrive/c to c:\ (or whatever your drive letter is).

To do this,

  1. From the editor error page, select the "Edit Source Lookup Path..." button and select the "Add..." button
    • Or, in the eclipse IDE, go to menu Window -> Preferences -> C/C++ -> Debug-> Common Source Lookup Path -> Add.
  2. From the list of lookup containers, choose Path Mapping and OK. You get a New Mapping in the list.
  3. Select the mapping and then Edit. In the Modify the path mappings dialog, select Add, and then enter:
    • /cygdrive/c as the compilation path and
    • c:\ as the local file system path.
  4. Select OK, OK, OK to finish the dialogs.
  5. Terminate the debug session and restart; it should find your source files now.

This setting will apply to any debug sessions launched from this workspace.

You can also modify the settings in each individual launch configuration.

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-08
  • 2021-12-13
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-28
  • 2021-11-20
  • 2022-01-09
  • 2021-10-27
  • 2021-04-17
相关资源
相似解决方案