delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/06/25/15:14:53

X-Originating-IP: [200.34.143.5]
From: "J. L." <jlsgarrido AT hotmail DOT com>
To: <djgpp AT delorie DOT com>
References: <ac26a5e4 DOT 0206250917 DOT 2d1e22da AT posting DOT google DOT com>
Subject: Re: error while linking using GMP library
Date: Tue, 25 Jun 2002 13:28:22 -0500
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
Message-ID: <OE39Se8Skw2i4YHzqYH000023b4@hotmail.com>
X-OriginalArrivalTime: 25 Jun 2002 18:28:39.0868 (UTC) FILETIME=[209D17C0:01C21C76]
Reply-To: djgpp AT delorie DOT com

----- Original Message -----
From: "Andrew" <nonsemantic AT aol DOT com>
Newsgroups: comp.os.msdos.djgpp
To: <djgpp AT delorie DOT com>
Sent: Tuesday, June 25, 2002 12:17 PM
Subject: error while linking using GMP library


> Hello, I am getting a linker error while compiling the following code:
>
> ---
> // test the gmp library:
>
> #include <iostream>

using namespace std;

> #include <gmpxx.h>
>
> int main ()
> {
>   mpz_class a, b, c;
>
>   a = 1234;
>   b = 5678;
>   c = a+b;
>   std::cout << "sum is " << c;
>
>   return 0;
> }
> ---
>
> The command line options I am using are as follows:
>
> ---
> C:\test>gpp bignum.cpp -o bignum.exe -lgmp

Add -lstdcxx -lm  (in this order!) before -lgmp

> ---
>
> I get this error:
>
> ---
>
c:/djgpp/tmp\ccaIkv3J.o(.gnu.linkonce.t._ZlsRSoRK10__gmp_exprI12__gmpz_value
S1_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!

J. L.

- Raw text -


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