[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiling a C++ program with gmpxx.h

From: Kevin Ryde
Subject: Re: Compiling a C++ program with gmpxx.h
Date: Sat, 27 Apr 2002 06:59:39 +1000
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.1 (i386-debian-linux-gnu)

emarti19 <address@hidden> writes:
> address@hidden programming]$ g++ test.cpp
> /tmp/ccqhPZVJ.o: In function `__gmp_expr<__gmpz_value, 
> __gmpz_value>::__gmp_expr(void)':
> /tmp/ccqhPZVJ.o(.__gmp_expr<__gmpz_value, 
> __gmpz_value>::gnu.linkonce.t.(void)+0xe): undefined reference to 
> `__gmpz_init'
> /tmp/ccqhPZVJ.o: In function `__gmp_expr<__gmpz_value, 
> __gmpz_value>::~__gmp_expr(void)':
> /tmp/ccqhPZVJ.o(.gnu.linkonce.t._._t10__gmp_expr2Z12__gmpz_valueZ12__gmpz_valu
> e+0x11): 
> undefined reference to `__gmpz_clear'
> collect2: ld returned 1 exit status

You need to link to libgmp and libgmpxx,

        g++ test.cpp -lgmpxx -lgmp

Incidentally, the code produced by gmpxx.h is much improved by "-O",
since it uses a lot of "inline"s.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]