public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Ilski <kilski@wp.pl>
To: japan <ngmnhat@yahoo.com>, gcc-help@gcc.gnu.org
Subject: Re: I can't compile this program!
Date: Sat, 15 Feb 2003 17:04:00 -0000	[thread overview]
Message-ID: <200302151804.55692.kilski@wp.pl> (raw)
In-Reply-To: <20030214052538.86474.qmail@web11006.mail.yahoo.com>

Hi.
On Friday 14 February 2003 06:25, japan wrote:
> I want to ask some questions!
>
> I have an ANSI C program named test.c:
>
> /*test.c*/
> #include <stdio.h>
> #include <math.h>
> main()
> {
>   printf("%f\n",sqrt(4));
>   return 0;
> }
>
> I can't compile this code. I used command:
>
> gcc -o test test.c
>
> Please tell me why and how to compile that code!
>
> Thanks.

You have to tell linker to add 'libm[ath]' library.

try:

gcc -lm -o test test.c



  reply	other threads:[~2003-02-15 17:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-14  5:25 japan
2003-02-15 17:04 ` Jakub Ilski [this message]
2003-02-17 15:58   ` japan
2003-02-17 16:02     ` Mihnea Balta
2003-02-14  5:30 Ajay Bansal
2003-02-17 19:59 Dockeen

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=200302151804.55692.kilski@wp.pl \
    --to=kilski@wp.pl \
    --cc=gcc-help@gcc.gnu.org \
    --cc=ngmnhat@yahoo.com \
    /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).