LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Can't Compile GMP with gcc mac 10.4.11 (https://www.linuxquestions.org/questions/programming-9/cant-compile-gmp-with-gcc-mac-10-4-11-a-635595/)

phy1729 04-15-2008 05:56 PM

Can't Compile GMP with gcc mac 10.4.11
 
Ok I realize this is a Linux forum, but can I at least be pointed to a more relevant forum.

My problem is when I try to compile a program with GMP gcc doesn't compile but gives the error:

/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
___gmpz_get_d
___gmpz_init
___gmpz_mul_ui
___gmpz_set_ui
collect2: ld returned 1 exit status

I'm compiling from terminal using the command

gcc clarkkkkson.c -o clarkkkkson

and I have tried the options

-lgmp
-lgmp -L/usr/local/include
-lgmp -L/usr/local/lib
-lgmp -L/usr/local/lib/
-lgmp -L/usr/local/lib/libgmp.dylib
-lgmp -L/usr/local/lib/libgmp.a
-lgmp -L/usr/local/lib/libgmp.la
-L/usr/local/lib/libgmp.dylib
-L/usr/local/lib/libgmp.la
-L/usr/local/lib/libgmp.a
-L/usr/local/lib/

to no avail. The source code is

Code:

double fact(unsigned int number, unsigned int class_) {
        mpz_t return_;
        mpz_init(return_);
        mpz_set_ui(return_,1);
        unsigned int i;
        if(class_-1) for(i=1;i<=number;i++) mpz_mul_ui(return_,return_,fact(i, class_-1));
        else for(i=1;i<=number;i++) mpz_mul_ui(return_,return_,i);
        return mpz_get_d(return_);
        mpz_clear(return_);
}

I have compiled GMP myself and did run make check after make and make install. And I did try recompiling.

j-ray 04-16-2008 03:06 AM

i dont think the .dylib resides in /usr/local/lib
rather in /System/Library or /Library
but i dont have a Mac within reach right now...
so im just guessing


All times are GMT -5. The time now is 04:33 PM.