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 14:24 |
Denis Davydov Messages: 8 Registered: January 2012 |
Junior Member |
|
|
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 14:39] Report message to a moderator
|
|
| |
Re: No source file named main.cpp [message #792977 is a reply to message #792900] |
Tue, 07 February 2012 16:23 |
Denis Davydov Messages: 8 Registered: January 2012 |
Junior Member |
|
|
Hagen wrote on Tue, 07 February 2012 09:50On 2/7/2012 3:24 PM, Denis Davydov wrote:
> The program runs from a folder other than one it is compiled in, if that
> matters.
It does matter.
Well, that is the case for both NetBeans and Eclipse.
So, which settings do I need to check in order to make Eclipse work as expected?
[Updated on: Tue, 07 February 2012 16:23] Report message to a moderator
|
|
|
Re: No source file named main.cpp [message #793478 is a reply to message #792977] |
Wed, 08 February 2012 07:23 |
Hagen Messages: 90 Registered: April 2010 |
Member |
|
|
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 08:08 |
Denis Davydov Messages: 8 Registered: January 2012 |
Junior Member |
|
|
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 08:28] Report message to a moderator
|
|
| | | |
Re: No source file named main.cpp [message #793704 is a reply to message #793681] |
Wed, 08 February 2012 13:04 |
Denis Davydov Messages: 8 Registered: January 2012 |
Junior Member |
|
|
Axel Mueller wrote on Wed, 08 February 2012 07:34Hm, that is weird. OK, then try to add "Compilation directory".
Thank you for your help, it works now.
Somehow Default inclusion of project folder with its sub-folders didn't work.
Sub-folders have some duplicated files which are not used in compilation, but it is definitely not the reason since I tried adding "Compilation directory" with sub-folders and it also works with no problems.
[Updated on: Wed, 08 February 2012 13:04] Report message to a moderator
|
|
| | | | |
Goto Forum:
Current Time: Thu Sep 19 21:36:15 GMT 2024
Powered by FUDForum. Page generated in 0.04379 seconds
|