After (supposedly semi-)successfully installing mpir thanks to BIll Hart, I 
tried to compile and run my .cpp program.  But I got a list of compile 
errors, which I believe is linked to mpir.

First, I used

    ./configure --with-yasm=/usr/local/bin/yasm --enable-cxx

to install mpir on my Ubuntu 16.04 LTS (on an Intel Core 2 Duo U9300 CPU).

The header files in my cpp source code are (just some regular stuff):

#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <mpir.h>
#include <stdlib.h>
#include <string.h>

In my program, I simply used those floating-point mpf_ functions, such as 
mpf_set(), mpf_sub(), mpf_add(), mpf_mul(), mpf_init(), mpf_clear(), etc.  
Nothing fancy.  The compile command I used is

    g++ -std=c++11 -lmpir -lmpirxx BigPi.cpp


And I got the following errors:

/tmp/ccPY8XNc.o: In function `borwein()':
BigPi.cpp:(.text+0x40): undefined reference to `__gmpf_set_default_prec'
BigPi.cpp:(.text+0x57): undefined reference to `__gmpf_init_set_d'
BigPi.cpp:(.text+0x7f): undefined reference to `__gmpf_init_set_d'
BigPi.cpp:(.text+0xa7): undefined reference to `__gmpf_init_set_d'
BigPi.cpp:(.text+0xcf): undefined reference to `__gmpf_init_set_d'
BigPi.cpp:(.text+0xde): undefined reference to `__gmpf_init'
BigPi.cpp:(.text+0xf7): undefined reference to `__gmpf_sqrt'
BigPi.cpp:(.text+0x11a): undefined reference to `__gmpf_inits'
BigPi.cpp:(.text+0x13a): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x15a): undefined reference to `__gmpf_sub'
BigPi.cpp:(.text+0x17a): undefined reference to `__gmpf_sub'
BigPi.cpp:(.text+0x1a1): undefined reference to `__gmpf_clears'
BigPi.cpp:(.text+0x1da): undefined reference to `__gmpf_inits'
BigPi.cpp:(.text+0x21d): undefined reference to `__gmpf_inits'
BigPi.cpp:(.text+0x236): undefined reference to `__gmpf_set'
BigPi.cpp:(.text+0x266): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x286): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x2a6): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x2c6): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x2e6): undefined reference to `__gmpf_sub'
BigPi.cpp:(.text+0x2ff): undefined reference to `__gmpf_sqrt'
BigPi.cpp:(.text+0x318): undefined reference to `__gmpf_sqrt'
BigPi.cpp:(.text+0x338): undefined reference to `__gmpf_sub'
BigPi.cpp:(.text+0x358): undefined reference to `__gmpf_add'
BigPi.cpp:(.text+0x378): undefined reference to `__gmpf_div'
BigPi.cpp:(.text+0x398): undefined reference to `__gmpf_add'
BigPi.cpp:(.text+0x3b1): undefined reference to `__gmpf_set'
BigPi.cpp:(.text+0x3d1): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x3f1): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x411): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x431): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x451): undefined reference to `__gmpf_add'
BigPi.cpp:(.text+0x471): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x491): undefined reference to `__gmpf_mul'
BigPi.cpp:(.text+0x4b1): undefined reference to `__gmpf_sub'
BigPi.cpp:(.text+0x511): undefined reference to `__gmpf_clears'
BigPi.cpp:(.text+0x53c): undefined reference to `__gmpf_clears'
BigPi.cpp:(.text+0x54b): undefined reference to `__gmpf_init'
BigPi.cpp:(.text+0x56b): undefined reference to `__gmpf_div'
BigPi.cpp:(.text+0x5a6): undefined reference to `__gmpf_get_str'
BigPi.cpp:(.text+0x706): undefined reference to `__gmpf_clears'
collect2: error: ld returned 1 exit status

I get the impression that in this faulty configuration of mine, the link 
between mpf_ functions and the underlying gmp functions is broken.  But I 
don't know how to fix it.

Strangely enough, I tried to compile this same cpp program on a different 
computer running Mac OS (High Sierra on an Intel 4th gen. i5 CPU) with mpir 
package installed (also by me) and it was successful.  I was also able to 
run it and get the correct results for, yes you guessed it, a million 
digits of pi.  So this leads me to believe somehow mpir was 
configured/installed/built differently on my Ubuntu and my Mac OS even 
though I used the same exact configure command

    ./configure --with-yasm=/usr/local/bin/yasm --enable-cxx


Please help me resolve the issue.  My Mac OS is a desktop and I can't carry 
it around with me to school.  Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"mpir-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mpir-devel+unsubscr...@googlegroups.com.
To post to this group, send email to mpir-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/mpir-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to