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

Re: Simple c program won't compile



I think I will forget this for a while myself. 
also, when using ncurses.h, you need to compile
with  -lncurses .

xucaen


--- Mark Phillips <mark@infoeng.flinders.edu.au>
wrote:
> I've just solved my own problem.  Of course I
> needed to do
> 
> $ gcc thick.c -lm
> 
> It's been a while since I've used C.  Sorry for
> the silly question.
> 
> Cheers,
> 
> Mark.
> 
> 
> Mark Phillips [mark@infoeng.flinders.edu.au]
> wrote:
> > Hi,
> > 
> > The following program:
> > 
> > 
> > #include <stdio.h>
> > #include <math.h>
> > 
> > int main(int argv, char **argc){
> >   double x;
> > 
> >   x=sqrt(5.0);
> > }
> > 
> > 
> > does not compile.  Instead I get the errors:
> > 
> > $ gcc thick.c
> > /tmp/ccU9fgSr.o: In function `main':
> > /tmp/ccU9fgSr.o(.text+0x16): undefined
> reference to `sqrt'
> > collect2: ld returned 1 exit status
> > 
> > 
> > What is wrong?
> > 
> > Thanks,
> > 
> > Mark.
> > 
> > -- 
> >
>
_/~~~~~~~~\___/~~~~~~\____________________________________________________
> >
>
____/~~\_____/~~\__/~~\__________________________Mark_Phillips____________
> >
>
____/~~\_____/~~\________________________________mark@ist.flinders.edu.au_
> >
>
____/~~\HE___/~~\__/~~\APTAIN_____________________________________________
> >
>
____/~~\______/~~~~~~\____________________________________________________
> >
>
__________________________________________________________________________
> >         "They told me I was gullible ... and
> I believed them!" 
> > 
> 
> -- 
>
_/~~~~~~~~\___/~~~~~~\____________________________________________________
>
____/~~\_____/~~\__/~~\__________________________Mark_Phillips____________
>
____/~~\_____/~~\________________________________mark@ist.flinders.edu.au_
>
____/~~\HE___/~~\__/~~\APTAIN_____________________________________________
>
____/~~\______/~~~~~~\____________________________________________________
>
__________________________________________________________________________
>         "They told me I was gullible ... and I
> believed them!" 
> 
> 
> -- 
> To UNSUBSCRIBE, email to
> debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble?
> Contact listmaster@lists.debian.org
> 


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/



Reply to: