public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* howto sqrt?
@ 1999-12-07  1:36 Joachim Bauernberger
  1999-12-07  1:50 ` haha
  1999-12-31 22:24 ` Joachim Bauernberger
  0 siblings, 2 replies; 6+ messages in thread
From: Joachim Bauernberger @ 1999-12-07  1:36 UTC (permalink / raw)
  To: help-gcc

hi!
i'm pretty new using the gcc. most of my programming sofar has been
under windoze 8-( using the borland tools.
unfortunatly i am not able to use the sqrt or pow function. can anybody
tell me what i'm doing wrong here?

if i compile the following c program using the compiler options: gcc -g
-D_GNU_SOURCE -Wall filename.c -o outputfile
i get these errors:    undefined reference to 'sqrt'

my simple test program looks like this:

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

int main ()

{
        double  x = 900;


                       printf("\nSquare root of x = %f\n", sqrt(x));

return 0;
}

and it's the same with pow:

double x = 5, y;
y = pow(x,2);
printf("\n%g\n",y);


gives me undefined reference to pow??????

i'm sorry for boring you with newbie stuff like that.
i'd really appreaciate if anybody could help me out.....
thank's joachim!



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: howto sqrt?
  1999-12-07  1:36 howto sqrt? Joachim Bauernberger
@ 1999-12-07  1:50 ` haha
  1999-12-07  7:34   ` Joachim Bauernberger
  1999-12-31 22:24   ` haha
  1999-12-31 22:24 ` Joachim Bauernberger
  1 sibling, 2 replies; 6+ messages in thread
From: haha @ 1999-12-07  1:50 UTC (permalink / raw)
  To: help-gcc

Joachim Bauernberger <nuklear@singnet.com.sg> wrote:

:>i'm pretty new using the gcc. most of my programming sofar has been
:>under windoze 8-( using the borland tools.
:>unfortunatly i am not able to use the sqrt or pow function. can anybody
:>tell me what i'm doing wrong here?

Yes. You haven't read the FAQ which answers your question which has been
asked and answered frequently.

:>if i compile the following c program using the compiler options: gcc -g
:>-D_GNU_SOURCE -Wall filename.c -o outputfile
:>i get these errors:    undefined reference to 'sqrt'

You just need one more option: -lm, which links in the math-library.
This library defines sqrt(), pow() and many other mathematical functions.
Haha!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: howto sqrt?
  1999-12-07  1:50 ` haha
@ 1999-12-07  7:34   ` Joachim Bauernberger
  1999-12-31 22:24     ` Joachim Bauernberger
  1999-12-31 22:24   ` haha
  1 sibling, 1 reply; 6+ messages in thread
From: Joachim Bauernberger @ 1999-12-07  7:34 UTC (permalink / raw)
  To: help-gcc

haha@here.org wrote:

> Joachim Bauernberger <nuklear@singnet.com.sg> wrote:
>
> :>i'm pretty new using the gcc. most of my programming sofar has been
> :>under windoze 8-( using the borland tools.
> :>unfortunatly i am not able to use the sqrt or pow function. can anybody
> :>tell me what i'm doing wrong here?
>
> Yes. You haven't read the FAQ which answers your question which has been
> asked and answered frequently.
>
> :>if i compile the following c program using the compiler options: gcc -g
> :>-D_GNU_SOURCE -Wall filename.c -o outputfile
> :>i get these errors:    undefined reference to 'sqrt'
>
> You just need one more option: -lm, which links in the math-library.
> This library defines sqrt(), pow() and many other mathematical functions.
> Haha!

no you're right i havn't read the faq.
thank's for pointing things out.
joachim!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: howto sqrt?
  1999-12-07  7:34   ` Joachim Bauernberger
@ 1999-12-31 22:24     ` Joachim Bauernberger
  0 siblings, 0 replies; 6+ messages in thread
From: Joachim Bauernberger @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

haha@here.org wrote:

> Joachim Bauernberger <nuklear@singnet.com.sg> wrote:
>
> :>i'm pretty new using the gcc. most of my programming sofar has been
> :>under windoze 8-( using the borland tools.
> :>unfortunatly i am not able to use the sqrt or pow function. can anybody
> :>tell me what i'm doing wrong here?
>
> Yes. You haven't read the FAQ which answers your question which has been
> asked and answered frequently.
>
> :>if i compile the following c program using the compiler options: gcc -g
> :>-D_GNU_SOURCE -Wall filename.c -o outputfile
> :>i get these errors:    undefined reference to 'sqrt'
>
> You just need one more option: -lm, which links in the math-library.
> This library defines sqrt(), pow() and many other mathematical functions.
> Haha!

no you're right i havn't read the faq.
thank's for pointing things out.
joachim!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* howto sqrt?
  1999-12-07  1:36 howto sqrt? Joachim Bauernberger
  1999-12-07  1:50 ` haha
@ 1999-12-31 22:24 ` Joachim Bauernberger
  1 sibling, 0 replies; 6+ messages in thread
From: Joachim Bauernberger @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

hi!
i'm pretty new using the gcc. most of my programming sofar has been
under windoze 8-( using the borland tools.
unfortunatly i am not able to use the sqrt or pow function. can anybody
tell me what i'm doing wrong here?

if i compile the following c program using the compiler options: gcc -g
-D_GNU_SOURCE -Wall filename.c -o outputfile
i get these errors:    undefined reference to 'sqrt'

my simple test program looks like this:

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

int main ()

{
        double  x = 900;


                       printf("\nSquare root of x = %f\n", sqrt(x));

return 0;
}

and it's the same with pow:

double x = 5, y;
y = pow(x,2);
printf("\n%g\n",y);


gives me undefined reference to pow??????

i'm sorry for boring you with newbie stuff like that.
i'd really appreaciate if anybody could help me out.....
thank's joachim!



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: howto sqrt?
  1999-12-07  1:50 ` haha
  1999-12-07  7:34   ` Joachim Bauernberger
@ 1999-12-31 22:24   ` haha
  1 sibling, 0 replies; 6+ messages in thread
From: haha @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

Joachim Bauernberger <nuklear@singnet.com.sg> wrote:

:>i'm pretty new using the gcc. most of my programming sofar has been
:>under windoze 8-( using the borland tools.
:>unfortunatly i am not able to use the sqrt or pow function. can anybody
:>tell me what i'm doing wrong here?

Yes. You haven't read the FAQ which answers your question which has been
asked and answered frequently.

:>if i compile the following c program using the compiler options: gcc -g
:>-D_GNU_SOURCE -Wall filename.c -o outputfile
:>i get these errors:    undefined reference to 'sqrt'

You just need one more option: -lm, which links in the math-library.
This library defines sqrt(), pow() and many other mathematical functions.
Haha!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-12-31 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-07  1:36 howto sqrt? Joachim Bauernberger
1999-12-07  1:50 ` haha
1999-12-07  7:34   ` Joachim Bauernberger
1999-12-31 22:24     ` Joachim Bauernberger
1999-12-31 22:24   ` haha
1999-12-31 22:24 ` Joachim Bauernberger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).