GNU Multiple Precision Arithmetic Library 6.1.1 for Visual Studio 2015

A small tip outside my expertise, enjoy.

For building GMP (GNU Multiple Precision Arithmetic Library, http://gmplib.org) under Windows you can follow theses easy step;

– Get latest GMP [1].

– Create a folder to store your GMP’s library (example C:\gmp)

– Get [MinGW][2].

– Do a full install of MinGW. (+-400m)

– Run msys.bat from C:\MinGW\msys\1.0 if you installed in the default directory.

– Run ./configure --prefix=/c/GMP --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 -disable-static --enable-shared. Please note there I didn’t used --enable-cxx as the c++ module does not seem to compile well with the new GMP’s library. (It reference inttypes.h that mingw can’t find)

– Run make

– Run make install

-Run dumpbin /exports libgmp-10.dll >libgmp-10.exports

-Edit the file libgmp-10.exports to leave there only the function name.

-Run lib /def:libgmp-10.def /out:libgmp-10.lib

and voila, you are done.

You will have a .h and a .lib library that you can link to Visual Studio like a .lib.

[1]: http://gmplib.org
[2]: http://sourceforge.net/projects/ming

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s