delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/06/25/22:00:17

From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: error while linking using GMP library
Date: Tue, 25 Jun 2002 20:19:33 +0100
Lines: 34
Message-ID: <3D18C245.39312534@phekda.freeserve.co.uk>
References: <ac26a5e4 DOT 0206250917 DOT 2d1e22da AT posting DOT google DOT com>
NNTP-Posting-Host: modem-41.cesium.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: news5.svr.pol.co.uk 1025033747 27942 62.136.46.41 (25 Jun 2002 19:35:47 GMT)
NNTP-Posting-Date: 25 Jun 2002 19:35:47 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

Andrew wrote:
[snip]
> The command line options I am using are as follows:
> 
> ---
> C:\test>gpp bignum.cpp -o bignum.exe -lgmp
> ---
> 
> I get this error:
> 
> ---
> c:/djgpp/tmp\ccaIkv3J.o(.gnu.linkonce.t._ZlsRSoRK10__gmp_exprI12__gmpz_valueS1_E
> +0x1c):bignum.cpp: undefined reference to `operator<<(std::ostream&,
> __mpz_struc
> t const*)'
> 
> collect2: ld returned 1 exit status
> ---
> 
> Anyone know what may be causing this?  It seems like the linker can't
> find the standard library...  Thanks!

Actually I think the linker cannot find an appropriate operator<< to output
__mpz_structs to a std::ostream. I expect that this function is in libgmpxx.a.
Try linking in libgmpxx.a (the C++ part of the GMP library):

    gpp bignum.cpp -o bignum.exe -lgmp -lgmpxx

Hope that helps, regards,

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


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