Using C++ output functions
Wolfram Wiesemann
wolfram.wiesemann at gmail.com
Wed Feb 14 12:51:59 CET 2007
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
I get the following error message:
/usr/local/lib/libgmpxx.a(osmpf.o): In function
`operator<<(std::basic_ostream<char, std::char_traits<char> >&, __mpf_struct
const*)':
osmpf.cc:(.text+0x131): undefined reference to `__gmp_doprnt_mpf2'
osmpf.cc:(.text+0x139): undefined reference to `__gmp_asprintf_final'
/usr/local/lib/libgmpxx.a(osfuns.o):(.rodata+0x4): undefined reference to
`__gmp_asprintf_memory'
/usr/local/lib/libgmpxx.a(osfuns.o):(.rodata+0x8): undefined reference to
`__gmp_asprintf_reps'
collect2: ld returned 1 exit status
If I remove the line "cout << f" from the code, everything works fine. I
have used the "--enable-cxx" parameter during the make process, so that
should be okay.
Can anybody give me a hint what I need to do?
Best,
Wolfram
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gmplib.org/list-archives/gmp-discuss/attachments/20070214/3b80f576/attachment.html
More information about the gmp-discuss
mailing list