public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mihnea Balta <dark_lkml@mymail.ro>
To: japan <ngmnhat@yahoo.com>, gcc-help@gcc.gnu.org
Subject: Re: I can't compile this program!
Date: Mon, 17 Feb 2003 16:02:00 -0000	[thread overview]
Message-ID: <200302171800.52857.dark_lkml@mymail.ro> (raw)
In-Reply-To: <20030217155852.59238.qmail@web11006.mail.yahoo.com>

On Monday 17 February 2003 17:58, japan wrote:
> Although I included math.h in the source code, why I must add -lm
> option when we compile one program using math functions???
>
> Ex: gcc -lm -o test test.c
>
> (test.c uses math functions and have already included math.h!)
>
> What libs we must link when compiling like that?

You included the header file, which contains the function prototypes, 
#defines, etc. That's got nothing to do with the linker, which must be told 
to link your code against the math library (libmath). The -lm flag tells it 
to do that. Go learn the difference between a header and a shared library.

  reply	other threads:[~2003-02-17 16:02 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
2003-02-17 15:58   ` japan
2003-02-17 16:02     ` Mihnea Balta [this message]
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=200302171800.52857.dark_lkml@mymail.ro \
    --to=dark_lkml@mymail.ro \
    --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).