Author Topic: Install GMP library with codeblocks  (Read 21794 times)

Offline rohan076

  • Single posting newcomer
  • *
  • Posts: 4
Install GMP library with codeblocks
« 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:

Offline MaxGaspa

  • Almost regular
  • **
  • Posts: 128
Re: Install GMP library with codeblocks
« Reply #1 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.

Offline rohan076

  • Single posting newcomer
  • *
  • Posts: 4
Re: Install GMP library with codeblocks
« Reply #2 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)

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Install GMP library with codeblocks
« Reply #3 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.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline rohan076

  • Single posting newcomer
  • *
  • Posts: 4
Re: Install GMP library with codeblocks
« Reply #4 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!

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9595
Re: Install GMP library with codeblocks
« Reply #5 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/
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.
« Last Edit: September 29, 2006, 08:00:24 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline rohan076

  • Single posting newcomer
  • *
  • Posts: 4
Re: Install GMP library with codeblocks
« Reply #6 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

Offline bluekid

  • Multiple posting newcomer
  • *
  • Posts: 57
  • What is blue ? Blue is the invisible becoming visi
Re: Install GMP library with codeblocks
« Reply #7 on: September 30, 2006, 02:11:05 pm »
 :lol: :lol:
What is blue ? Blue is the invisible becoming visible.

Offline Hamed

  • Single posting newcomer
  • *
  • Posts: 2
Re: Install GMP library with codeblocks
« Reply #8 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?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6951
    • My Best Post
Re: Install GMP library with codeblocks
« Reply #9 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.
« Last Edit: November 21, 2010, 06:31:29 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline Hamed

  • Single posting newcomer
  • *
  • Posts: 2
Re: Install GMP library with codeblocks
« Reply #10 on: November 22, 2010, 04:26:22 am »
Doesn't work for me.
After I add nothing happened.