Using GMP 4.2.1 on Visual C++, Windows XP

Sisyphus sisyphus1 at
Tue Dec 5 00:53:12 CET 2006

----- Original Message ----- 
From: "Ismet Togay" <ismet at>
> I have found the following web page which shows the integration of GMP and
> Visual C++:

I suspect that page applies only to the building 4.1. Perhaps the author of
that page has updates for 4.2.1.

If you're dreating a dynamic (dll) build, you could always build GMP-4.2.1
in the MSYS shell with the MinGW compiler, and use that dll with VC++. From

-- quote--
A MINGW DLL build of GMP can be used with Microsoft C. Libtool doesn't
install a .lib format import library, but it can be created with MS lib as
follows, and copied to the install directory. Similarly for libmp and
 cd .libs
 lib /def:libgmp-3.dll.def /out:libgmp-3.lib
MINGW uses the C runtime library `msvcrt.dll' for I/O, so applications
wanting to use the GMP I/O routines must be compiled with `cl /MD' to do the
same. If one of the other C runtime library choices provided by MS C is
desired then the suggestion is to use the GMP string functions and confine
I/O to the application.
 --end quote--

If you want to build a static GMP library, I think that, too, will work with
VC++ if you also link to MinGW's libgcc.a. (Not sure about this .... it has
been a while since I tried....)

Other than that, there's

More information about the gmp-discuss mailing list