www.digitalmars.com         C & C++   DMDScript  

D - Tips for Debugging Linking Errors?

reply Benji Smith <dlanguage xxagg.com> writes:
I'm working on my XML api, and I'm finally happy with the design (which has gone
through several permutations). I've weeded out and fixed all of the compiler
errors, but now I'm stuck with a few linker errors, and I have no idea how to
fix or debug them. Coming from a background that includes Java, perl, php, VB,
JavaScript, and only a teeny-tiny amount of C++, I have very little experience
dealing with linkers.

The linker errors I'm getting look like this:

_xmlparser.obj(_xmlparser)
Error 42: Symbol Undefined __Class_documentbuilder_DocumentBuilder
_xmlparser.obj(_xmlparser)
Error 42: Symbol Undefined
__Ddocumentbuilder_DocumentBuilder__ctor_FAaZC31documentbuilder_DocumentBuilder
--errorlevel 2

I've decoded some of this stuff--since it's pretty obvious--like the fact that
the linker is having trouble linking the _xmlparser.obj file with some symbols
in the documentbuilder.obj file. And it looks like its complaining about the
DocumentBuilder constructor. But I've got a constructor. And its method
signature matches the signature being called in the _xmlparser.d file.
Sooooo....now what?

I'm using digc to compile and link my project, so there shouldn't be a problem
with calling the linker in the wrong order.

I'm curious as the meaning of the "FAaZC31" code and how I can use that to help
my debug process. And, if a build process doesn't generate any compilation
errors, why would it generate linking errors?
Aug 19 2003
parent "Walter" <walter digitalmars.com> writes:
The first thing I'd do is make sure you're using 0.69 for all the files, as
it changed the way name mangling is done. The names you're showing are for
0.68 and earlier. Next, I'd use grep across the .obj files and see which
files define the undefined symbols and which .obj files refer to them. You
can use obj2asm on the .obj files to help identify where the symbols go.

The type id string mangling can be figured out by looking at
\dmd\src\dmd\mtype.c. Look for the 'deco' functions.
Aug 21 2003