Wayne et. al.,

> Wayne Dunkel wrote:
> > 
> > I have included math.h in my source file, but gcc says that 
> the reference to sin is undefined. what should I do?
> 
> Read a book on programing for the kernel. Functions like sin are not
> available in kernel space. I would suggest using a lookup 
> table of some
> sort.

        I would not recommend listening to Dr. Brummelaar in this case.  The
sin function is provided, like most transcendentals, by any recent version
of gcc.  This is one of the many optimizations that gcc now (for the past
five years or so) performs with -O1 (or higher) on the compile line.  You do
not need to include -lm, you do not need to include -lc (both of these are
big trouble in kernel space), you need only do two things:

1) Use the rtl.mk make include file that was delivered with RTLinux - it
passes lots of switches to gcc and makes everything happy.  This is also the
best way to make sure you have a current set of definitions, etc. in your
Makefile.  Why re-invent the wheel when FSM Labs *provides* a wheel.

2) Provide a pointer to libgcc to your ld line.

        An example of how to do all this is provided in the Makefile that I
posted to the newsgroup back on July 3rd.  While *that* message suggests
that you need to use -lm (libm, the math library), you do not need to do so.

Regards,

Steve Cohen

----- End of forwarded message from [EMAIL PROTECTED] -----
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to