delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/06/25/13:30:21

From: nonsemantic AT aol DOT com (Andrew)
Newsgroups: comp.os.msdos.djgpp
Subject: error while linking using GMP library
Date: 25 Jun 2002 10:17:53 -0700
Organization: http://groups.google.com/
Lines: 42
Message-ID: <ac26a5e4.0206250917.2d1e22da@posting.google.com>
NNTP-Posting-Host: 206.17.226.3
X-Trace: posting.google.com 1025025474 29052 127.0.0.1 (25 Jun 2002 17:17:54 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 25 Jun 2002 17:17:54 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello, I am getting a linker error while compiling the following code:

---
// test the gmp library:

#include <iostream>
#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
---

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!

    -Andrew Plewe-

- Raw text -


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