Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: ixfd64 on March 11, 2008, 04:11:48 am

Title: GMP (GNU Multi-Precision library)
Post by: ixfd64 on March 11, 2008, 04:11:48 am
I am planning to do some programming with the GMP (http://gmplib.org/) library. I know that GMP was originally made for Linux, so I downloaded the Windows port (http://cs.nyu.edu/exact/core/gmp).

I compiled the sources on Cygwin and got a file called libgmp.a, which seems to be the library file. Does anyone know where I should place libgmp.a and gmp.h (the header file) for it to work with Code::Blocks?

Thanks in advance.
Title: Re: GMP (GNU Multi-Precision library)
Post by: MortenMacFly on March 11, 2008, 09:16:16 am
I compiled the sources on Cygwin and got a file called libgmp.a, which seems to be the library file. Does anyone know where I should place libgmp.a and gmp.h (the header file) for it to work with Code::Blocks?
Leave them where they are and setup your project accordingly (search directories for the compiler/linker and librar{y/ies} for the linker).
Title: Re: GMP (GNU Multi-Precision library)
Post by: straka.milan on March 11, 2008, 09:59:54 pm
I compiled the sources on Cygwin and got a file called libgmp.a, which seems to be the library file. Does anyone know where I should place libgmp.a and gmp.h (the header file) for it to work with Code::Blocks?

Or you can put them in the include and lib directories of the compiler you are using.

I.e. if you use Codeblocks 8.02 with mingw bundled and you installed it to C:\Program files\Codeblocks,
than put libgmp.a to C:\Program files\Codeblocks\Mingw\lib and gmp.h to C:\Program files\Codeblocks\Mingw\include.

This way all projects can use gmp, just #include <gmp.h> at the beginning and add
library gmp in the linker section of the project configuration.