"undefined reference to `ceilf'"

c, eclipse

Solution

`ceilf` is part of the math library, so you need to link with `-lm` to use it. Just `#include <math.h>` is not enough.

Problem

Simple question. I'm importing code previously written by someone else into eclipse. I am getting the error: ``` "undefined reference to `ceilf'" ``` when I use `ceilf`. It appears to me that `ceilf` is suppose to be contained in the math.h library which is included in my file. However, when I open up the /usr/include/math.h file I don't see a ceilf method defined. In fact as far as I can tell none of the math.h files on my redhat deployment have a `ceilf` method. Any idea where the wayward `ceilf` method is defined? Since this code works and even compiles elsewhere the issue has to be with my configuration rather then the code itself. ps. I can use the regular `ceil` method. I've considered just switching to it, but it would be less efficent in a critical path of the program. Yes I know premature optimization is evil, but I'm asking as much out of curiousity as to why I would have the error anyways. I can't see why my `math.h` files wouldn't defile it. EDIT:: thank you for explaining why I can't find the `ceilf` function, I understand that problem. However, I don't know how to appease eclipse. I've tried setting the compiler option to use std=c99 as suggested and it doesn't remove the error. In fact I thought eclipse was just using my Makefile to do the build, and the make file doesn't throw the exception. Is there something I can do to cause the editor to realize I have the file defined?

Original source