how to start using GMP
Blake Huff
stangmechanic at gmail.com
Tue Aug 1 11:14:10 CEST 2006
First, everyone's favorite response: This is a GNU C compiler
question, or a Unix question, but not really a gmp problem, so you
should brush up on both of those before working with GMP.
Second: The answer to your question. This issue arises because your
compiler doesn't know where to look for the gmp library. You can add
the -L./ flag to tell your compiler to look in the current directory,
or -L../gmp-4.2.1, etc. You might could get away with adding the
full path name to your #include directive, i.,e #include "/User/Home/
gmp4-.2.1/gmp", that works on my system. Anyways, these are just a
few of your options for letting the compiler find the library.
-H
On Aug 1, 2006, at 2:00 AM, Dongvu Tonien wrote:
> Hi,
>
> I know the question is silly- but I have scanned through Manual, but I
> still don't know how to use GMP. Please help me.
>
> I downloaded the GMP and had it on my Unix account
>
> $HOME/gmp-4.2.1
>
> I went inside the directory gmp-4.2.1 and followed the install
> instructions:
> ./configure, make, make check, which run ok
>
> Then I created a new directory $HOME/test and wrote a simple
> program: t.cc
>
> #include "gmp.h"
>
> int main (void){
> mpz_t integ;
> mpz_init_set_str (integ, "3141592653589793238462643383279502884",
> 10);
> mpz_clear(integ);
> return 0;
> }
>
> compile it:
> g++ t.cc -lgmpxx -lgmp
> t.cc:1:17: error: gmp.h: No such file or directory
>
> So I changed #include "gmp.h" to #include "../gmp-4.2.1/gmp.h"
> compile it, but still error
>
> g++ t.cc -lgmpxx -lgmp
> ld: fatal: library -lgmpxx: not found
> ld: fatal: library -lgmp: not found
> ld: fatal: File processing errors. No output written to a.out
> collect2: ld returned 1 exit status
>
> Thank you for your time.
> --Dongvu
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at swox.com
> https://gmplib.org/mailman/listinfo/gmp-discuss
Blake Huff
stangmechanic at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gmplib.org/list-archives/gmp-discuss/attachments/20060801/3e09b402/attachment.html
More information about the gmp-discuss
mailing list