www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/23/13:11:22

From: kaz AT vision DOT crest DOT nt DOT com (Kaz Kylheku)
Newsgroups: comp.lang.c,comp.lang.c++,comp.os.msdos.djgpp
Subject: Re: g++ linke error.
Date: 23 Sep 1996 15:40:47 GMT
Organization: /usr/local/lib/news/organization
Lines: 35
Message-ID: <526b1v$78a@bcrkh13.bnr.ca>
References: <525dvj$n79 AT lion DOT cs DOT latrobe DOT edu DOT au>
NNTP-Posting-Host: 47.63.64.170
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019