help:use GMP in VC++

himanshu jain special.himanshu at gmail.com
Sun May 9 13:47:57 CEST 2010


Hi,
   I am new to both GMP and VC++. I want to do some large number arithmetic
of cryptography.I found the link

http://cs.nyu.edu/exact/core/gmp/

In this link i found four steps for windows under the heading  Visual C++
6.0 & Visual C++ .Net

In Core Library distribution, we provide patch files for building GMP
library under Visual C++:

   1. Download latest GMP and unzip to ${gmp_build}
   2. Copy all files under patches/4.1-static (or patches/4.1-dynamic for
   building DLL) to ${gmp_build}
   3. Open gmp.dsw (gmp.vcproj for VC++.Net) to build GMP
   4. After building, you can use gmp.h, lib/gmp.lib, lib/gmpDebug.lib to
   build your GMP application. (If you build GMP DLL, then you need gmp.dllor
   gmpDebug.dll for runing your application.)

I have done above four steps.In gmp project i have included my file (name.c)
in source files and i am able to compile it but unable to build name.exe.

Please help me with how to use GMP in VC++ 6.0. I have windows vista.

Also i have form a new project in vc++ and  include gmp.h in header file and
include library gmp.lib and gmpDebug.lib. I am able to compile and build
both the below program

#include<stdio.h>
#include<conio.h>
#include<gmp.h>
#include<math.h>

void main()
{
    mpz_t p,q,phi;
    printf("enter p and q");
    gmp_scanf("%Zd%Zd\n",p,q);
    mpz_mul(phi,p-1,q-1);

}

but the problem is when I input a large number from console it gave some
exception (means GMP is not working) while on other hand i am able to output
a large no (2^1024) .

Please help me and let me know if i am not clear at any point.

Thanks & Regards
Himanshu


More information about the gmp-discuss mailing list