[ale] Missing "floor"?

leam hall leamhall at gmail.com
Wed Jun 19 10:49:32 EDT 2013


Morning Ed!

I'm looking around (googling) to understand what you mean and I'm not
getting it. math.h is included in the program and exists in /usr/include.

Leam



On Wed, Jun 19, 2013 at 10:30 AM, Ed Cashin <ecashin at noserose.net> wrote:

> Maybe link the math library?  A quick check suggests that's it.
>
> [ecashin at marino ~]$ man floor | grep Link
>        Link with -lm.
> [ecashin at marino ~]$
>
> On Wed, Jun 19, 2013 at 10:18 AM, leam hall <leamhall at gmail.com> wrote:
>
>> Not sure why I'm getting:
>>
>> gcc -Wall -Werror -o rand rand.c
>> /tmp/ccAJ7e8S.o: In function `main':
>> rand.c:(.text+0x16): undefined reference to `floor'
>> collect2: ld returned 1 exit status
>>
>> ###
>> rand.c
>> ###
>>
>> #include <stdio.h>
>> #include <unistd.h>
>> #include <stdlib.h>
>> #include <math.h>
>>
>> int main(void) {
>>
>>     int num;
>>     float val = 2.3;
>>     num = floor(val);
>>     printf("num is %d.\n", num);
>>
>>     return 0;
>> }
>>
>> --
>> Mind on a Mission <http://leamhall.blogspot.com/>
>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>>
>

-- 
Mind on a Mission <http://leamhall.blogspot.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20130619/1b4d8be4/attachment.html>


More information about the Ale mailing list