What wrong with compiler? Bug?

Hai…all,

Hope you all can solve my problem. My application need header file
#include <math.h> and its mathematical functions like fabs(). Ironicly, when I try to compile sample program of fabs() funtion error occurs that:

toterr2.o * In function main': undefined reference to fabs’
toterr2.o * undefined reference to fabs' undefined reference to fabs’
undefined reference to `fabs’

How come some sample codes got some error? I’ve experience more than this when compile certain sample code in Momentic but I can modified it. In this case, I can’t.

Did qnx developer test all sample code before release to public?

u need to link in the actual library, not just include the header file

the qnx.com/developers/docs/mome … /fabs.html says u need the libm library

eg:
cc dummy.c -l m
will include (link) the math library in the executable

read more on the subject in the documentation for build tools and library calls

Thanks mezek… :slight_smile: