To avoid some linking errors

Walter Bright newshound2 at digitalmars.com
Tue Oct 30 15:00:18 PDT 2012


On 10/30/2012 2:49 PM, Andrei Alexandrescu wrote:
> On 10/30/12 5:40 PM, Brad Roberts wrote:
>> On Tue, 30 Oct 2012, Andrei Alexandrescu wrote:
>>
>>> On 10/30/12 5:07 PM, Brad Roberts wrote:
>>>> 1) Why did the compiler believe it would be?  If it didn't think it was a
>>>> valid usable symbol, it would have already errored at the call site during
>>>> semantic analysis.
>>>
>>> Not getting this at all. All I'm saying is that if the compiler says "I can't
>>> find that foo() you're asking for", the most interesting piece of information
>>> for me is "where did I ask for it?"
>>
>> Ok, so it points to a place in the code where you used it.  You look at
>> that and say, yup, I did indeed use it.  Not surprising.
>
> In the presence of overloading, that is most often surprising. And usually it's
> not "I" who uses it, it's transitively called by some code I write. That's the
> hardest part.
>
>> Now, why doesn't
>> the linker find it?
>
> Because it's declared but not explicitly made part of the project.
>
>> Why did the compiler believe it existed?
>
> Grep takes care of that. Finding the declaration is never a problem.

I find it ironic that you mention grep. Grep is what I suggested in the link to 
dealing with the issue, but nobody likes that answer.

http://www.digitalmars.com/ctg/OptlinkErrorMessages.html#symbol_undefined


>> The site of the usage isn't remotely useful for answering either of those
>> questions and those are the ones that form the disconnect between the
>> compiler, who believed it existed and let the code pass to the next
>> stage), and the linker.
>
> Non-issue. Grep takes care of that. Finding the cross-references and the
> overloading part are the hard problems here. This is so clear to me for so many
> reasons, I am paralyzed by options.

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.



More information about the Digitalmars-d mailing list