Re: sqrt problem

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

 



On 11/17/2014 06:16 PM, Ali Abdul Ghani wrote:
> /tmp/cc0fh9Tm.o: In function `eratosthenes':
> q.c:(.text+0x31): undefined reference to `sqrt'
> collect2: error: ld returned 1 exit status
> What is the problem and what is the solution?

If you want math, you link with libm.

http://stackoverflow.com/questions/5419366/why-do-i-have-to-explicitly-link-with-libm
http://stackoverflow.com/questions/1033898/why-do-you-have-to-link-the-math-library-in-c

This has been so since the dawn of time itself.

Andrew.





[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