Re: gcc with math library

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

 



On Tue, 2005-06-07 at 00:13 -0300, Raphael Fonseca wrote:
> When I try to compile with gcc -otest test.c         it  caused the 
> following error message:
> 
> /home/raphael/tmp/ccUXVGLx.o(.text+0x2c): In function `main':
> : undefined reference to `sin'
> collect2: ld returned 1 exit status

gcc -o test test.c -lm should work

You need to tell the linker to use the math library, hence the -lm flag

regards
saurabh



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux