[C++] incomplete installation (libgmpxx.la).

Christian P. MOMON cp.momon@ocmland.org
Wed, 25 Dec 2002 19:09:42 +0100


delta trinity wrote:
>> But, i dont see the libgmpxx.* file !???????
> 
> 
> There's no libgmpxx.* as far as I know.  You use gmpxx.h that is a 
> wrapper for implementing c++ style functions.  It use libgmp.*.
> 

Don't you use the "-lgmpxx" parameter for your compiler ?
The documentation tells us to use it:
http://www.swox.com/gmp/manual/Headers-and-Libraries.html#Headers%20and%20Libraries

Example:
#include <iostream>
#include <gmpxx.h>

void main ()
{
   mpz_class tt1, tt2, tt3;

   tt1 = "20923928392892";
   tt2 = "9823092839";
   tt3 = tt1*tt2;
   cout << tt3 << endl;
}

ocm@ocmstar (19:01:23) ~/C/ 399 > g++ t.C -lgmp
/tmp/ccpWLenU.o: In function `operator<<(ostream &, 
__gmp_expr<__gmpz_value, __gmpz_value> const &)':
/tmp/ccpWLenU.o(.gnu.linkonce.t.__ls__FR7ostreamRCt10__gmp_expr2Z12__gmpz_valueZ12__gmpz_value+0x21): 
undefined reference to `operator<<(ostream &, __mpz_struct const *)'
collect2: ld returned 1 exit status

ocm@ocmstar (19:03:53) ~/C/ 403 > g++ t.C -L ~ocm/Labo/gmp-4.1.1/.libs 
-lgmpxx -lgmp
ocm@ocmstar (19:04:07) ~/C/ 404 > ./a.out
205537691159966183700388


  am i forgetting something ?

  Regards,

  Cpm.
-- 
        __    __    __
  (o_  |     |__|  |  |         "CPM est Christian P. M____."    ('<
  /)   |__ . |   . |  | .           cp.momon@ocmland.org       ,',)