“没有命名的源文件"错误调试 Eclipse CDT [英] "No source file named" error debugging Eclipse CDT

查看:18
本文介绍了“没有命名的源文件"错误调试 Eclipse CDT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有共享库(动态加载)的项目,我正在尝试调试它.我收到以下错误消息:

I've got a project with a shared library (loaded dynamically), and I'm attempting to debug it. I get the following error message:

No source file named /home/username/Code/path/to/project/MyFile.cpp.

在搜索了其他线程之后,我确保我正在使用 -g 进行编译,并且相应的文件夹位于调试配置的源路径选项卡上.奇怪的是它给出了正确的绝对路径:它引用的文件确实存在,所以我不明白为什么它认为它不存在.

After having searched other threads, I've ensured that I'm compiling with -g, and that the appropriate folders are on the source paths tab of debug configurations. The strange part is that it's giving the correct absolute path: the file it references does exist, so I don't understand why it doesn't think it's there.

有人知道该怎么办吗?

推荐答案

我刚刚遇到了同样的问题,虽然我的断点在可执行文件本身,而不是在共享库中.为了解决这个问题,我不得不打开调试配置",选择我的调试配置并调整以下设置:

I just came across the same issue, although my breakpoints were in the executable itself, not in a shared library. To solve this, I had to open the "Debug configuration", select my debug configuration and adjust the following settings:

  • 在底部,有一个选择其他..."链接来选择创建进程启动器.点击链接.勾选使用配置特定设置".选择标准创建流程启动器",然后按确定".
  • 转到调试器"标签,然后在标签顶部选择调试器:gdb/mi".可能/可能不会有所不同:在同一个选项卡上还有一个复选框使用完整文件路径设置断点" - 我玩过这个,但它似乎不会影响我们观察到的问题(显然,我们的源路径已经是完整的路径).
  • At the bottom, there is a link "Select other ..." to select the Create Process launcher. Click the link. Tick the "Use configuration specific settings". Select "Standard Create Process Launcher" and press "Ok".
  • Go to the "Debugger" tab, and on the top of the tab select "Debugger: gdb/mi". What may/may not make a difference: On the same tab there is also a checkbox "Use full file path to set breakpoints" - I played with this, but it does not seem to affect the issue we observe (obviously, our source paths are already full paths).

对于共享库中的断点,您可能需要来自 使用 eclipse cdt 和 gdb 进行调试为什么eclipse cdt 会忽略断点吗.

For breakpoints in shared libraries, you might need additional information (especially about deferred breakpoints) from Debugging with eclipse cdt and gdb and Why does eclipse cdt ignore breakpoints.

注意:这是指 Eclipse Kepler (4.3) 和 gdb 7.4.

这篇关于“没有命名的源文件"错误调试 Eclipse CDT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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