This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Using Math Functions


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]