undefined reference to `floor`
Peng Fan
van.freenix at gmail.com
Mon Sep 16 10:58:55 UTC 2013
2013/9/16 Sebastian Huber <sebastian.huber at embedded-brains.de>
> On 2013-09-16 12:25, Peng Fan wrote:
>
>> hi,
>>
>> I want to use math function in rtems, and add such a function:
>> 77 int test(float a)
>> 78 {
>> 79 int b= floor(a);
>>
>
> The prototype is "double floor(double x)". Please have a look at floorf().
still fail.
>
>
> 80 return b;
>> 81 }
>> When compiling, it tells 'undefined reference to `floor'
>> collect2: error: ld returned 1 exit status'
>>
>> I do not know how to resolve this. I tried to pass `-lm` to gcc, but still
>> failed to link.
>>
>
> Can you please provide the full command line?
>
/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
This is the command. Thanks.
>
>
> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone : +49 89 189 47 41-16
> Fax : +49 89 189 47 41-09
> E-Mail : sebastian.huber at embedded-**brains.de<sebastian.huber at embedded-brains.de>
> PGP : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> ______________________________**_________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/**listinfo/rtems-users<http://www.rtems.org/mailman/listinfo/rtems-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20130916/3685e4c1/attachment-0001.html>
More information about the users
mailing list