bug-glibc
[Top][All Lists]
Advanced

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

Re: Possible GNU C Library Problem


From: Andreas Jaeger
Subject: Re: Possible GNU C Library Problem
Date: Wed, 26 Dec 2001 21:35:17 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) XEmacs/21.4 (Artificial Intelligence, i386-suse-linux)

James Ricks <address@hidden> writes:

> I am a relatively new-comer to Linux.  I presently use SuSE linux 7.3
> Professional and am very pleased with it.  For many years I have used

Glad to hear!

> various versions of C but the GNU C Compiler is the most impressive I
> have come across.  However, I have encountered an interesting problem
> that I cannot solve.  In one of my first programs using gcc I utilized
> the `exp`, `pow`, and `log` math functions.  I received error messages
> as follows:
>                            "undefined reference to `exp`"
>                            "undefined reference to `pow`"
>                            "undefined reference to `log`"
>                             etc.
>
> I declared <math.h> as an include statement in the preprocessor part of
> the program as is customary and as indicated in the Mathematics section
> of the GNU C Library Manual.  I have not had this kind of problems with
> any of the other header files I have used.
>
> The programs I am using are gcc 2.95.3 and glibc 2.2.3.  Any help you
> can give would be greatly appreciated!

You need to link against the math library libm, just add "-lm" to your
build command line.

On Unix system you have to add all used libraries extra, inclusion of
a header file does not add a library.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs address@hidden
   private address@hidden
    http://www.suse.de/~aj



reply via email to

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