public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Art Haas <arthur.haas@westgeo.com>
To: help-gcc@gnu.org
Subject: Re: math.h prob
Date: Tue, 30 Nov 1999 23:28:00 -0000	[thread overview]
Message-ID: <lrwvrzefty.fsf@yoda.wg.waii.com> (raw)
Message-ID: <19991130232800.Z_eZ1jLE2qzZ9fZhaJBPj0AHe15GQRyvd_Y2qnWQDx4@z> (raw)
In-Reply-To: <38204719.FD2DC371@clinmed.gla.ac.uk>

Dave Brennan <9147261b@clinmed.gla.ac.uk> writes:

> Hi,
> 
> I am having problems using maths functions. e.g if I have the program
> 
> #include <stdio.h>
> #include <math.h>
> 
> main()
> {
> double x;
> scanf("%lf",&x);
> printf("x = %lf",sqrt(x));
> }
> 
> and try to compile it using,
> 
> gcc -o test mattest.c
> 
> I get the following error:
> 
> Undefined                       first referenced
>  symbol                             in file
> sqrt                                /var/tmp/cc9Eay_r1.o
> ld: fatal: Symbol referencing errors. No output written to test
> 

You need to link in the math library ...

% gcc -o test mattest.c -lm

-- 
###############################
# Art Haas
# (713) 689-2417
###############################

  reply	other threads:[~1999-11-30 23:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-03  8:21 Dave Brennan
1999-11-03  8:27 ` Art Haas [this message]
1999-11-30 23:28   ` Art Haas
1999-11-03  8:28 ` haha
1999-11-30 23:28   ` haha
1999-11-03  8:30 ` Ffoobarr
1999-11-30 23:28   ` Ffoobarr
1999-11-03  9:51 ` Dave Brennan
1999-11-30 23:28   ` Dave Brennan
1999-11-03 13:25 ` Rick Dearman
1999-11-30 23:28   ` Rick Dearman
1999-11-30 23:28 ` Dave Brennan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=lrwvrzefty.fsf@yoda.wg.waii.com \
    --to=arthur.haas@westgeo.com \
    --cc=help-gcc@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).