Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #62555

Re: Need help with an odd error...

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Need help with an odd error...
Date Sun, 24 May 2015 15:38:46 -0700
Organization None to speak of
Lines 36
Message-ID <87wpzxob2h.fsf@kst-u.example.com> (permalink)
References <mjtj7h$nlo$1@speranza.aioe.org>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="9be37d943435275679235b07c7947eef"; logging-data="22675"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ycMw2jKGSJu9IcOQL0j2S"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:IjXsgKOUvgkvk3qmE5Liry3cAFE= sha1:lgaq+44gMfIzDkFwhqefTUuuIAQ=
Xref csiph.com comp.lang.c:62555

Show key headers only | View raw


"Chris M. Thomasson" <cristom@charter.net> writes:
[...]
> #include <math.h>
> #include <stdio.h>
>
> double
> my_cos(double v)
> {
>    return cos(v);
> }
>
> int main()
> {
>    printf("my_cos(3.14) = %f\r\n", my_cos(3.14));
>
>    return 0;
> }
[...]
> sh-4.3# gcc -o main *.c
>
> /tmp/ccXNUoFK.o: In function `my_cos':
>
> main.c:(.text+0x1b): undefined reference to `cos'

Compile with:

    gcc -o main *.c -lm

(Prepare for a flame war over whether the need to specify "-lm" when
using the math library is a bug or not.)

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Need help with an odd error... "Chris M. Thomasson" <cristom@charter.net> - 2015-05-24 15:26 -0700
  Re: Need help with an odd error... Keith Thompson <kst-u@mib.org> - 2015-05-24 15:38 -0700
  Re: Need help with an odd error... Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-05-24 23:39 +0100
  Re: Need help with an odd error... James Kuyper <jameskuyper@verizon.net> - 2015-05-24 18:53 -0400
    Re: Need help with an odd error... Stephen Sprunk <stephen@sprunk.org> - 2015-05-24 19:15 -0500
  Re: Need help with an odd error... "Chris M. Thomasson" <cristom@charter.net> - 2015-05-24 16:18 -0700
    Re: Need help with an odd error... "Chris M. Thomasson" <cristom@charter.net> - 2015-05-24 16:54 -0700
    Re: Need help with an odd error... Johannes Bauer <dfnsonfsduifb@gmx.de> - 2015-05-27 19:48 +0200

csiph-web