🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++.leda
Article #192

Re: linker errors

#192
From: Pat Morin
Date: Sun, 17 Jan 1999 00:00
56 lines
3117 bytes
Larry Brasfield wrote:


> Your query would be better directed to gnu.g++,
> where you would find a higher proportion of
> folks familiar with that compiler and linker.

Thanks for the tip.  I'll try that.

> >libtmp/_spring.o: In function `acosh':
> >libtmp/_spring.o(.text+0x418): multiple definition of `acosh'
> >libtmp/_ABMP_matching.o(.text+0x418): first defined here
> >
> >Mostly complaining about symbols from the math library (math.h)
> >that are multiply defined.
> 
> You are linking inappropriate libraries.  I
> don't know why you're linking that stuff,
> but you should spend some time with the
> "nm" utility, learning what is to be found
> defined in each library.  Hint: It is easier
> to sort out a few missing definitions than
> to cure scads of duplicate ones.  It helps
> to have got the definitions listed via nm
> into a set of text files that you can grep.

First, some background.  LEDA is a C++ library of data structures
and algorithms.  It's well used, documented, and tested, and
comes with a configuration utility and makefiles for a number of
different platforms/compilers including Linux/g++.  The errors
that I posted here occur when I compile the demo code that comes
with the libraries, after, of course, compiling the libraries
themselves.  The files spring.o and ABMP_matching.o are object
files included in the libraries.

The function acosh that the linker is complaining about in the
above output is part of the standard C math library, linked in by
passing the -lm argument to the linker.  I've looked in the files
spring.c and ABMP_matching.c and acosh is definitely not
redefined in these files, but math.h is #included in these
files.  So, for some reason, it looks like just #including'ing
math.h is causing these symbols to be defined in the object
files.

Normally, I would think that this is a problem with the
Makefiles, but LEDA is pretty well tested, and a problem this big
would have been fixed long ago.  The compiler and linker I'm
using is the stock g++ that comes with Red Hat Linux 5.2, so that
shouldn't be the problem either.  Since I don't think that my
situtation is unique, I was hoping that someone else might have
run into exactly the same problem and been able to give me a one
line solution. No luck so far.

Thanks anyway,

Pat
Technical Details
Message-ID: <36A2209E.49DDAD16@scs.carleton.ca>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <369FFC8E.5C9E6AC5@scs.carleton.ca> <%FUn2.156$jV.216@news.rdc1.wa.home.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10ba33,29f3d2546169cf7f,start
X-Google-Attributes: gid10ba33,public
X-Google-Thread: 109fba,1186c24adb85fdfc
X-Google-Attributes: gid109fba,public
X-Google-Thread: fef06,1186c24adb85fdfc
X-Google-Attributes: gidfef06,public
From: Pat Morin <morin@scs.carleton.ca>
Subject: Re: linker errors
Date: 1999/01/17
Message-ID: <36A2209E.49DDAD16@scs.carleton.ca>
X-Deja-AN: 433696240
Content-Transfer-Encoding: 7bit
References: <369FFC8E.5C9E6AC5@scs.carleton.ca> <%FUn2.156$jV.216@news.rdc1.wa.home.com>
Content-Type: text/plain; charset=us-ascii
Organization: Carleton University
Mime-Version: 1.0
Newsgroups: comp.lang.c++.leda,comp.lang.c++,gnu.g++.help
NNTP-Posting-User: morin pmorin@chat