Mail Archives: djgpp/1996/09/23/13:11:22
In article <525dvj$n79 AT lion DOT cs DOT latrobe DOT edu DOT au>,
Cs3prj Group 04 <cs3prj04 AT lion DOT cs DOT latrobe DOT edu DOT au> wrote:
>I am reasonably good at finding and solving logical errors in C
>programs but when it comes to link errors I constantly find myself
>floundering.
>
>I find the error output of c linkers to be absolute meaningless waffle.
There are no ``c linkers''. In a given system, you may find that the same
linker is used for assembly language programs, Fortran, Modula, C, Pascal
C++...
>I recently got an undefined symbol error in a source file of around 4000
>lines. As per usual there is no source file line number specified nor
>even a function name to go on.
>
>I was there fore forced to comment out the contents of every function and
>uncomment them one by one, re-compiling each time, until the error
>re-appeared.
>
>Surely there is a better way. I have tried nm but I find the output of that
>to be equally meaningless.
That's because you are talking about C++, not C, based on your Subject: header
field. C++ compilers implement type safe linkage, and they typically do this by
encoding type information in each external symbol _name_. Thus the name of the
function ``int foo()'' gets mangled into something that is quite unlike ``foo''
or ``_foo'', something whose obscurity is rivaled only by its voluntary
equivalent known as Hungarian notation.
If you are linking object files generated from C programs, the output of ``nm''
can be quite revealing and helpful.
You should resubmit your query to a C++ newsgroup. There exists a FAQ for
g++, also.
- Raw text -