[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
math.h
- Date: Thu, 04 Sep 2003 11:04:12 -0500
- From: joel.sherrill at OARcorp.com (Joel Sherrill)
- Subject: math.h
Bert wrote:
> Hi, here is a newbie's question:
> i want RTEMS to do some simple calculations,
> so there are functions like "sin(x)" and
> "cos(x)" in the codes.
> but when i compile the codes, it tells me
> that "undefined reference to sin" and
> "undefined reference to cos" ...
> i have added "#include <math.h>" to the
> source code, what else should i do?
FYI this is a standard C FAQ.
math funcitons are in libm.a. This is the
same with almost any C Compiler installation
native or cross.
You have to link your application with the math
library. This should be accomplished by getting
"-lm" added to the command that links the
application. For simple native gcc cases, it is
something like this:
gcc hello.c -lm -o hello
--joel
> Bert
> ----------------------------------------------
> ??????????????????????????????????????????????
> http://y.21cn.com
> 21CN????????????????????????????????
> http://news.21cn.com
> ????????????????????????????21CN??????????
> http://mail.21cn.com/alliance/
> ????????????????????????????????
> http://news.21cn.com/social/
>
>
>
>
- References:
- math.h
- From: doclzs at 21cn.com (Bert)