bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gmp compile error


From: James Lambert
Subject: gmp compile error
Date: Sun, 31 Mar 2002 23:50:54 -0500

Hi
        I've just installed gmp 4.0.1, My computer is running definite linux 
7.0.
below is a copy of the source code I am using to test the library and the 
accompanying error message that gcc prints.
The purpose of the program is to compute the factorial of num.


#include <iostream.h>
#include <stdio.h>
#include "gmp.h"


int main ()
{
        mpz_t num, ans, less,two, one;
        mpz_init (num);
        mpz_init (ans);
        mpz_init (less);
        mpz_init_set_str (two,"2",10);
        mpz_init_set_str (one,"1",10);
                
        cout <<"Enter the number: \n";
        cin >> num;

        mpz_sub (less,num,one);

while (less >= two)
{
        mpz_mul (ans , num, less);
        mpz_sub (less, less, one);
}
return 0 ;


error message:
---------------
/tmp/ccnaCRiq.o: in function "main" :
/tmp/ccnaCRiq.o (.text+0x6c): undefined reference to 
"__rs__FR7istreamP12__mp2_struct"
collect 2: ld returned 1 exit status.
---------------

I am sure that gcc if finding the gmp library file correctly
I have tried using the mpz_mul and sub functions with and without void before 
them in case that was causing the 
problem.
This did not solve the problem so I felt I should report this to you. As far as 
I can make out my source code is fine, but I 
am new to gmp.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]