Using C++ output functions

Roberto Bagnara bagnara at cs.unipr.it
Thu Feb 15 07:30:29 CET 2007


Wolfram Wiesemann wrote:
> I guess this problem is less related to GMP than to general C++ 
> compilation,
> but it would be very helpful if someone could nevertheless explain me what
> to do.
> 
> When compiling the following simple program
> 
> #include <gmp.h>
> #include <gmpxx.h>
> #include <iostream>
> 
> using namespace std;
> 
> int main() {
>  mpf_class f;
>  f = 3.5 * 2.2;
>  cout << f;
>  return 0;
> }
> 
> with the following command
> 
> g++ max-npv.cc -static -lgmp -lgmpxx

Use one of these commands instead:

   g++ max-npv.cc -static -lgmpxx -lgmp

if you really want to prevent linking with
the shared libraries; or

   g++ max-npv.cc -lgmpxx

otherwise.  Notice also that it is enough to include
<gmpxx.h>.
All the best,

     Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it


More information about the gmp-discuss mailing list