[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] gcc - problems with math functions.
On Sat, 10 Jun 2000, Barrie Bremner wrote:
> Call me stupid, but I appear to be missing something here.
OK, stupid. <g> I think Barrie sounds better, though.
> I`m attempting to compile a small C program for a uni course, which
> uses
>
> #include <math.h>
>
> Whenever any lines involving maths functions are uncommented I get this
> error:
>
> [baz@shaitan baz]$ gcc versiontwo.c -o vtwo
> /tmp/ccMNZCnt.o: In function `main':
> /tmp/ccMNZCnt.o(.text+0x21b): undefined reference to `pow'
> /tmp/ccMNZCnt.o(.text+0x239): undefined reference to `pow'
> /tmp/ccMNZCnt.o(.text+0x24c): undefined reference to `sqrt'
> /tmp/ccMNZCnt.o(.text+0x27e): undefined reference to `atan'
> collect2: ld returned 1 exit status
>
> notice I`m only using gcc source.c -o output_program - should I be
> doing something else?
Yup. -lm. Rather illogical throughback to earlier times, but anything
deep-math related must be linked against the separate math library.
--
-----------------------------------------------------------------------
#include <disclaimer.h>
Matthew Palmer
mjp16@uow.edu.au
---------------------------------------------------------------------
Sheffield Linux User's Group - http://www.sheflug.co.uk
To unsubscribe from this list send mail to
- <sheflug-request [at] vuw.ac.nz> - with the word
"unsubscribe" in the body of the message.
GNU the choice of a complete generation.