To avoid some linking errors

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Oct 30 15:32:30 PDT 2012


On Tue, Oct 30, 2012 at 06:04:47PM -0400, Andrei Alexandrescu wrote:
> On 10/30/12 6:00 PM, Walter Bright wrote:
[...]
> >If you're missing a definition, you need to find the declaration, not
> >the use, because that's where the missing definition needs to go.
> >And finally, grepping for an un-mangled name doesn't work for
> >overloaded names.
> 
> Upon more thinking, I agree that BOTH declarations and call sites must
> be clearly pointed in the errors output by the linker. But I'll still
> point out that the real difficulty is finding the calls, not the
> declarations. I don't ever remember having a hard time "where is this
> declared?" Instead, the hard problem has always been "What is the call
> chain that leads to an undefined symbol?"
[...]

You're forgetting the case where the symbol *is* defined, but you forgot
to include it in the list of source files to link. In that case, knowing
where the declaration is will tell you which source file you probably
forgot to add to the linker command line.


T

-- 
Life would be easier if I had the source code. -- YHL


More information about the Digitalmars-d mailing list