highcalcula...@gmail.com wrote:
> I managed to do the following via MinGW:
> 
> - run ./configure --disable-static --enable-shared
> - make
> - make check
> 
> (Is this all and now I can start using it or is a step missing?...)

You have to run 'make install' as well.

Depending on whether you want to /exclusively/ use MPIR (which is a
drop-in *replacement* of GMP) as opposed to having parallel, independent
installations of both GMP and MPIR, you might consider configuring MPIR
with '--enable-gmpcompat'.

Roughly speaking, the latter just creates aliases for the headers and
libraries, such that you don't have to modify code to switch between
MPIR and GMP, i.e., you can '#include <gmp.h>' and use '-lgmp'
regardless of whether you're actually using GMP or its fork, MPIR.

If you intend to use the C++ layer of GMP/MPIR, you also have to
configure with '--enable-cxx'.  This is /not/ necessary if you just want
to use the C interface / library from within C++.


> Now I want to compile the following program called "mytest.cpp" with
> gcc; I tried typing "g++ mytest.cpp -o mytest" :
> 
> //-----------------------------------------------
> #include "mpir.h"
> #include "gmp.h"
> #include "gmp-impl.h"
> 
> using namespace std;
> 
> int main ()
> {
>     mpz_t z; 
> 
>     mpz_init(z);
>    
>     return (0);
> }
> //-----------------------------------------------


You don't have to (and shouldn't) include both mpir.h and gmp.h, nor
gmp-impl.h.  (It is sufficient to just include mpir.h, or, in case you
configured with '--enable-gmpcompat', just gmp.h.)

To link your program to the MPIR C library, you have to

    g++ mytest.cpp -o mytest -lmpir

(Again, in case you configured MPIR with '--enable-gmpcompat', 'g++
mytest.cpp -o mytest -lgmp' also works.)


-leif

-- 
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 http://groups.google.com/group/mpir-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to