<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/9/16 Sebastian Huber <span dir="ltr"><<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a>></span><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On 2013-09-16 12:25, Peng Fan wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
hi,<br>
<br>
I want to use math function in rtems, and add such a function:<br>
77 int test(float a)<br>
78 {<br>
79 int b= floor(a);<br>
</blockquote>
<br></div>
The prototype is "double floor(double x)". Please have a look at floorf().</blockquote><div style>still fail.</div><div style> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
80 return b;<br>
81 }<br>
When compiling, it tells 'undefined reference to `floor'<br>
collect2: error: ld returned 1 exit status'<br>
<br>
I do not know how to resolve this. I tried to pass `-lm` to gcc, but still<br>
failed to link.<br>
</blockquote>
<br></div>
Can you please provide the full command line?<br></blockquote><div> </div><div>/opt/rtems-4.11/bin/sparc-rtems4.11-gcc -qrtems -B/opt/rtems-4.11/sparc-rtems4.11/lib/ -B/opt/rtems-4.11/sparc-rtems4.11/sis/lib/ --specs bsp_specs -mcpu=cypress -O2 -g -Wall -Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs init.c.5.o main.c.5.o fs-root-tarfile.o -o rtld.prelink -Wl-Bstatic -L. -lrtl -Wl,-Bdynamic</div>
<div> </div><div style>This is the command. Thanks.</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<br>
-- <br>
Sebastian Huber, embedded brains GmbH<br>
<br>
Address : Dornierstr. 4, D-82178 Puchheim, Germany<br>
Phone : +49 89 189 47 41-16<br>
Fax : +49 89 189 47 41-09<br>
E-Mail : <a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-<u></u>brains.de</a><br>
PGP : Public key available on request.<br>
<br>
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.<br>
______________________________<u></u>_________________<br>
rtems-users mailing list<br>
<a href="mailto:rtems-users@rtems.org" target="_blank">rtems-users@rtems.org</a><br>
<a href="http://www.rtems.org/mailman/listinfo/rtems-users" target="_blank">http://www.rtems.org/mailman/<u></u>listinfo/rtems-users</a><br>
</blockquote></div><br></div></div>