🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #41574

math.h problems

#41574
From: Alan Chadwick
Date: Tue, 12 Mar 1996 00:00
38 lines
1084 bytes
In message <4i1kkd$a8d@irk.zetnet.co.uk>
        alan.chadwick@zetnet.co.uk (Alan Chadwick) writes: 

> This may seem like an easy problem, but can anyone tell me why the 
> following code gives "Undefined reference to 'sqrt'"

> I am using gcc 2.6.3 under Linux 1.2.1

> #include <stdio.h>
> #include <math.h>

> extern double sqrt();
> void printer(void);

> main()
> {
>  printf("This program will extract a square root. \n\n");
>  printer();
>  return (0);
> }

> void printer(void)
> {
>  double z = 5678.0;
>  double x;
>  x = sqrt(z);
>  printf("The square root of %lf is %lf  \n",z,x);
> }

> Thanks
> -- 
> alan.chadwick@zetnet.co.uk
> Bolton
> England

Sorry - the original message stated almath.h - I did mean math.h

Al
Technical Details
Message-ID: <4i2kh2$fo8@irk.zetnet.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,d174c2417079df44,start
X-Google-Attributes: gid11318c,public
From: alan.chadwick@zetnet.co.uk (Alan Chadwick)
Subject: math.h problems
Date: 1996/03/12
Message-ID: <4i2kh2$fo8@irk.zetnet.co.uk>
X-Deja-AN: 142504686
newsgroups: gnu.gcc.help