bug-gmp
[Top][All Lists]
Advanced

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

Re: Problems with compiling


From: Kent Boortz
Subject: Re: Problems with compiling
Date: 30 Dec 2001 19:13:59 +0100
User-agent: Gnus/5.070099 (Pterodactyl Gnus v0.99) Emacs/20.6

"Cool Genie" <address@hidden> writes:
> I've a Linux Mandrake 8.0 system installed. I've installed the GNU MP library
> (it was included on the CD's as a rpm package). Unfortunately, after compiling
> a simple program with gcc:
> 
>  $ gcc prime.c -o prime
> 
> I get the following error message:
> 
> /tmp/ccEXufVj.o: In function 'main':
> /tmp/ccEXufVj.o(.text+0xe): undefined reference to '__gmpz_init'
> collect2: ld returned 1 exit status
> 
> I'm new to Linux, so don't get mad if that's not you I should be writing to. I
> have no idea what could possibly go wrong. I haven't had any problems with
> other libraries installed as rpm's (for example: the KDE-devel library works
> fine). I've included the source code of the program I was compiling.

I don't think you have linked your code with functions in the KDE
libraries without specifying where to find them. This is a basic "How
do I compile a program" question and further questions should be
directed to another forum.

You need to tell the compiler (actually the linker) where to find the
gmp library, like

  % gcc -g prime.c -o prime -lgmp

or if the library is in a non standard location

  % gcc -g prime.c -o prime -L/path/to/lib/dir -lgmp

I just looked in the manual and find no reference how to link with
GMP.  This is assumed basic programming knowledge but I think it
doesn't hurt to include an example in the "GMP Basics" chapter. There
is an clarifying example in the source distributing INSTALL document
but this may not be the first place to look and the document may
not be part of the binary RPM distribution,

kent



reply via email to

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