[comp.lang.c] what means "multiply defined" ?

duns1222@w203zrz.zrz.tu-berlin.de (Martin Dunschen) (06/14/91)

I have a question, which sure can be answered by
most of the people subscribing to this newsgroup:

What is the meaning of error-messages from the UNIX
link editor "ld" about multiply defined symbols ?

These messages include the name of an archive file,
the name of the member in the archive and the name of the
multiply defined symbol, e. g.:

ld: libMY_LIB.a(my_rout.o): _my_symbol multiply defined

What can I do about it when the source code of
my_rout.o is not accessible ?

mstgil@sol.acs.unt.edu (Marc Ph. A. J. St.-Gil) (06/14/91)

duns1222@w203zrz.zrz.tu-berlin.de (Martin Dunschen) writes:

>I have a question, which sure can be answered by
>most of the people subscribing to this newsgroup:

>What is the meaning of error-messages from the UNIX
>link editor "ld" about multiply defined symbols ?

>These messages include the name of an archive file,
>the name of the member in the archive and the name of the
>multiply defined symbol, e. g.:

>ld: libMY_LIB.a(my_rout.o): _my_symbol multiply defined

>What can I do about it when the source code of
>my_rout.o is not accessible ?

It is likely that you have redefined that symbol within your
own code.  (That which you are linking with the lib)  Perhaps
you should have the symbol declared as extern?  If the offending
symbol is a function, you could make a copy of the lib and use
ar or some such program to remove that function from the lib.
Without further info, it is difficult to give better advice.

Good luck,
-- 
Marc St.-Gil, UNIX Systems Administrator   mstgil@{sol,vaxa,vaxb}.acs.unt.edu
 University of North Texas  817/565-2324   mstgil@{ponder,solo}.csci.unt.edu
 Academic Computing Services   DISCLAIMER: My employers had no idea I was
 PO Box 13495, Denton TX, 76203            going to say that.