Code::Blocks Forums

User forums => Help => Topic started by: rohan076 on September 27, 2006, 06:34:42 am

Title: Install GMP library with codeblocks
Post by: rohan076 on September 27, 2006, 06:34:42 am
Hi,
   I was developing a cryptographic application and I'll have to use the GMP library for it. now i use codeblocks for coding in C! how do i make use of the gmp library?? please help.

Thanks in advance,
Rohan. :shock:
Title: Re: Install GMP library with codeblocks
Post by: Max on September 27, 2006, 08:47:23 am
It is not difficult. You can use the MSYS (see www.mingw.org) system. You can simply follow the usual
build procedure of the Unix world (./configure then make).
Read the installation instruction before running the configure command to understand which options are good for you.
I do suggest to run the tests after compilation, it is mandatory to verify the compilation. If you get errors you cannot
trust in the library. If you don't get errors... it is possible that gmp works.

If you have problems I can send you (without any responsability) my libs and includes.

Regards

Max.
Title: Re: Install GMP library with codeblocks
Post by: rohan076 on September 28, 2006, 07:09:19 am
i dont quiet understand!!! i'm new to all of this, in the gmp folder, there is a gmp.h file, i've included that in the header of my program, is there anything else i gotta set, cause i get errors while compiling the code. can you be more precise with your method. thanks in advace.  8)
Title: Re: Install GMP library with codeblocks
Post by: thomas on September 28, 2006, 12:59:56 pm
When learning to program, learning how to use Google is the most important thing.

If you google for GMP library, the second hit you get is "GMP install instructions". That page not only describes exactly what you need to do to compile GMP with a variety of compilers, it also contains downloadable precompiled libraries which you can use right away.
Title: Re: Install GMP library with codeblocks
Post by: rohan076 on September 29, 2006, 04:58:13 am
hmm.......to tell u the truth i tried all of that, but nothing f*&(* works!!! its so frustrating!
Title: Re: Install GMP library with codeblocks
Post by: MortenMacFly on September 29, 2006, 07:58:48 am
hmm.......to tell u the truth i tried all of that, but nothing f*&(* works!!! its so frustrating!
It's hard to believe. Here is what I did:
1.) went to http://cs.nyu.edu/exact/core/gmp/ (http://cs.nyu.edu/exact/core/gmp/)
2.) downloaded the GMP-MinGW-package (http://cs.nyu.edu/exact/core/gmp/gmp-static-mingw-4.1.tar.gz (http://cs.nyu.edu/exact/core/gmp/gmp-static-mingw-4.1.tar.gz))
3.) extracted to a temp folder
4.) downloaded http://cs.nyu.edu/exact/core/gmp/gmp-4.1.tar.gz (http://cs.nyu.edu/exact/core/gmp/gmp-4.1.tar.gz)
5.) extracted to another temp folder to get the example [GMP-Folder]\demos\primes.c
6.) created a C console project with this as "main.c" file
7.) went to the build options of this project and:
- linker: add library "gmp" (without quotation marks)
- directories - compiler: added [GMP-MinGW-package]\include
- directories - linker: added [GMP-MinGW-package]\lib
8.) pressed "build & run".
--> 1..2..3 - everything works.
With regards, Morten.
Title: Re: Install GMP library with codeblocks
Post by: rohan076 on September 30, 2006, 04:59:32 am
thanks a lot, it worked perfect!!

can you give me some gmp help then?? please
i'm trying to generate a random number and this is what i did

gmp_randstate_t state;
int gmp_randinit_mt(state);
mpz_t rop;
mpz_init(rop);
mpz_urandomm (rop, state, N);
gmp_printf("\nS = %Zd\n", rop);

I dont see any output!!! N is 2^50
Title: Re: Install GMP library with codeblocks
Post by: bluekid on September 30, 2006, 02:11:05 pm
 :lol: :lol:
Title: Re: Install GMP library with codeblocks
Post by: Hamed on November 20, 2010, 10:43:05 am
I am windows user how can I do step number 3,5,7
Could you please explain more?
Title: Re: Install GMP library with codeblocks
Post by: stahta01 on November 21, 2010, 06:28:52 pm
I am windows user how can I do step number 3,5,7
Could you please explain more?

For steps 3 and 5; install 7Zip and right click on file use extract here.
right click on the new .tar file and use "extract to ..." or "extract here" the best choose varies.

7. went to the build options of this project
A. Project -> Build Options
- linker: add library "gmp" (without quotation marks)
A1. Tab: Linker Settings Subtab: Link Lib..
- directories - compiler: added [GMP-MinGW-package]\include
A2. Tab: Search Directory Subtab:Compiler
- directories - linker: added [GMP-MinGW-package]\lib
A3. Tab: Search Directory Subtab:Linker

Tim S.
Title: Re: Install GMP library with codeblocks
Post by: Hamed on November 22, 2010, 04:26:22 am
Doesn't work for me.
After I add nothing happened.