help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to trace a link error back to the responsible line of source cod


From: Paul Pluzhnikov
Subject: Re: How to trace a link error back to the responsible line of source code.
Date: 26 May 2004 23:26:00 -0700
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)

Steve Mading <spammersMustDie@real-addr-is-madings-at-bmrb-wisc-edu.invalid> 
writes:

> Quick summary:  Is there a way to make G++ and GLD trace
> back line number references to let me know where a particular
> function call is being attempted in the original source files?

You mean like this:

$ cat > foo.c
int main()
{
     return foobar() + 1;
}
^D

$ gcc -g foo.c
/tmp/ccAiW5Vp.o(.text+0xe): In function `main':
/home/paul/foo.c:3: undefined reference to `foobar'
collect2: ld returned 1 exit status

Oh, you probably are not on a system which has a linker that is
smart enough to tell you were the problem is.

> It seems to me like the information to be available to match
> the call attempt back to the source code line numbers that
> attempt it.  After all, such information is included for use
> by the debugger when I use a '-g' option, so it should somehow
> be there during the linking stage, if only I could get at it.

The info probably *is* available, and you probably *can* get at it,
but the way you do so depends on which system you are on, and you
didn't tell us. While you are at it, do also tell which version of
'gcc' you are using and how it was configured ('gcc -v' will
tell you).

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]