Home » Language IDEs » C / C++ IDE (CDT) » No source file named main.cpp((compared with NetBeans))
No source file named main.cpp [message #792881] |
Tue, 07 February 2012 09:24  |
Eclipse User |
|
|
|
Dear All,
Recently I experienced very common problem with
"No source file named /home/.../main.cpp."
With "Stop on startup at: main", gdb stops in main, but if I now try to add a breakpoinst there, I get this error.
If I have any breakpoints set up anywhere else (even in main.cpp) and I hit "Resume" - gdb does not stop there.
That's what I see in gdb traces:
193,524 23-break-insert --thread-group i1 -f /home/.../src/main.cpp:29
193,544 &"No source file named /home/.../src/main.cpp.\n"
193,545 23^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="<PENDING>",pending=\
"/home/.../src/main.cpp:29",times="0",original-location="/home/.../src/main.cpp:29"}
193,545 (gdb)
My project is made from existing sources and is compiled with "-g" option from a Makefile.
In "Debug Configurations->Source" I tried different configurations, as well as including just a FileSystem Dirrectory. Nothing helps.
The program runs from a folder other than one it is compiled in, if that matters.
In order to be sure that it does not depend on my Makefile or external libs compiled with/withot "-g", I installed NetBeans and compiled it with the same Makefile and run with a same command in the same folder. And it does indeed work there, no errors from dgb when I add breakpoints.
So I can conclude that it must have something to do with settings in Eclipse. Or maybe a bug?
Could you please advise where to look at and what to check?
Another thing is when I open a main.cpp from the "Project Explorer" it shows the file as "my_project/main.cpp", whereas if I debug it, I see "/home/.../main.cpp".
Thank you in advance for your help.
p/s/ Eclipse version is:
Version: Indigo Service Release 1
Build id: 20110916-0149
p/p/s/ I can access GDB logs from both NetBeans and Eclipse, but I have absolutely no experience with GDB...
[Updated on: Tue, 07 February 2012 09:39] by Moderator
|
|
| | |
Re: No source file named main.cpp [message #793478 is a reply to message #792977] |
Wed, 08 February 2012 02:23   |
Eclipse User |
|
|
|
On 2/7/2012 5:23 PM, Denis Davydov wrote:
> So, which settings do I need to check in order to make Eclipse work as
> expected?
In order to find the correct sources, debugger and debug IDE (gdb? and
Eclipse) BOTH must have the same understanding about where they are.
The debugger gets the info from the binary file.
Eclipse gets the info from the local project settings.
As I see it, you will have either to compile from a path within an
Eclipse project, or convince Eclipse to work with a different path.
[With the information you supplied nobody can answer your question.
No offense, but personally, I'd recommend to read, understand, and
follow the advice Eric Steven Raymond gives in "How To Ask Questions The
Smart Way". You get answers much faster. And useful ones.]
|
|
|
Re: No source file named main.cpp [message #793501 is a reply to message #793478] |
Wed, 08 February 2012 03:08   |
Eclipse User |
|
|
|
Hagen wrote on Wed, 08 February 2012 02:23On 2/7/2012 5:23 PM, Denis Davydov wrote:
> So, which settings do I need to check in order to make Eclipse work as
> expected?
In order to find the correct sources, debugger and debug IDE (gdb? and
Eclipse) BOTH must have the same understanding about where they are.
The debugger gets the info from the binary file.
Eclipse gets the info from the local project settings.
As I see it, you will have either to compile from a path within an
Eclipse project, or convince Eclipse to work with a different path.
Probably I did not make it clear before, but I compile from the path WITHIN the eclipse project. And I don't move binary file afterwards, I just specify Debug settings "Working directory" as something external. That's it.
So, judging from the Eclipse GUI that functionality should already be there.
[thank you for your advice. No offense, but the last time I asked a similar question with regards to another C++ IDE led to a bug filling and an update in the IDE. Actually another question of mine already led to a bug fix in PTP Eclipse, so it's not the first time I ask questions on-line...]
[Updated on: Wed, 08 February 2012 03:28] by Moderator
|
|
| | | | | | | |
Re: No source file named main.cpp [message #1797692 is a reply to message #792881] |
Mon, 05 November 2018 04:40  |
Eclipse User |
|
|
|
I just had a similar problem in Eclipse Oxygen CDT: I'm trying to debug code from a shared library built from outside Eclipse and CDT kept telling me that it could not find source files, even if I imported them inside an Eclipse project that is the only open one in the current workspace.
The library source code is split in several directories: "/src", "/lib" and "/include".
I was able to resolve the issue by specifying several "Path mappings" from the paths in the debug info of the library files (these were paths under "/tmp/", which is were the compilation took place) to the actual source paths.
|
|
|
Goto Forum:
Current Time: Wed Jul 23 09:40:08 EDT 2025
Powered by FUDForum. Page generated in 0.10153 seconds
|