News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Install GMP library with codeblocks

Started by rohan076, September 27, 2006, 06:34:42 AM

Previous topic - Next topic

rohan076

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:

Max

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.

rohan076

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)

thomas

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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

rohan076

hmm.......to tell u the truth i tried all of that, but nothing f*&(* works!!! its so frustrating!

MortenMacFly

#5
Quote from: 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!
It's hard to believe. Here is what I did:
1.) went to 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)
3.) extracted to a temp folder
4.) downloaded 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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

rohan076

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

bluekid

What is blue ? Blue is the invisible becoming visible.

Hamed

I am windows user how can I do step number 3,5,7
Could you please explain more?

stahta01

#9
Quote from: 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?

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.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Hamed

Doesn't work for me.
After I add nothing happened.