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

Re: OT: sqrt() not recognized in c program??



You need to link to the maths library.  Add the -lm option to your
linking line eg:
	gcc program -lm
HTH
Rich.

kaynjay@igalaxy.net wrote:
> 
> Does someone know why I would get the following errors in a compilation of a
> C app?  I would think that the sqrt function is in one of the libraries
> defined in the beginning of the code (e.g. #include <math.h> ).
> 
> kaynjay:/home/autodock/dist_3.0/src/autotors# cc -o autotors autotors.c
> /tmp/ccc01215: In function 'check_aromatic':
> /tmp/ccc01215(.text+0x1b4f): undefined reference to 'sqrt'
> /tmp/ccc01215: In function 'main':
> /tmp/ccc01215(.text+0xa586): undefined reference to 'sqrt'
> /tmp/ccc01215(.text+0xba83): undefined reference to 'sqrt'
> 
> The compile dies with these.
> 
> There are no directions for compiling.  I'm following the same pattern given
> for another program in the distribution.
> 
> Thanks for any help!
> 
> Kenward Vaughan
> 
> --
> Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null


Reply to: