This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Using Math Functions
- From: Anjali Sharma <anjalis at cdotd dot ernet dot in>
- To: calvesmit at ig dot com dot br, gcc at gcc dot gnu dot org
- Date: Tue, 04 Mar 2003 12:57:48 +0530
- Subject: Re: Using Math Functions
- >received: from aries.cdotd.ernet.in by cdotd.cdotd.ernet.in (SMI-8.6/SMI-SVR4)id NAA24574; Tue, 4 Mar 2003 13:06:20 -0500
- Organization: CDoT
- References: <200303040600.h2460KB0000000990@e-eihq01.eis.ernet.in>
Hi
Trying using "-lm" while linking your program
Hope this helps
Anjali
uucp-relay-delhi!calvesmit at ig dot com dot br wrote:
> I'm trying to compile the code below, but I can't to do it! gcc always
> complain.
> could someone help me? Why my sistem seems not know about math functions
> althoug i use #include math.h inclusion.
> send any hint to calvesmit at ig dot com dot br, 'cause I'm not a subscribe of your
> list.
>
> **********CODE***********
> #include <stdio.h>
> #include <stdlib.h>
> #include <math.h>
>
> int main(int argc,char *argv[])
> {
> int i;
> if(argc==2){
> i=atoi(argv[1]);
> printf("sin(%i)=%0.2f\n",i,sin(i));}
> return 0;
> }
>
> **************ERROR MESSAGE*************
> $gcc sin.c -osin
> /root/tmp/ccpbz3XU.o: In function 'main':
> /root/tmp/ccpbz3XU.o(.text+0x32): undefined reference to 'sqrt'
> collect2: ld returned 1 exit status
>
> _________________________________________________________
> Voce quer um iGMail protegido contra vírus e spams?
> Clique aqui: http://www.igmailseguro.ig.com.br