error compiling

rixed at rixed at
Tue Apr 7 16:26:24 CEST 2009

-[ Tue, Apr 07, 2009 at 04:11:31PM +0200, Anas Alzouhbi ]----
> but I obtained an error message like I don't include math.h

If you were not including math.h gcc (the compiler) would complain
about unknown symbol 'sqrt'.

> arm-angstrom-linux-gnueabi-gcc -march=armv4t -mtune=arm920t -std=gnu99
> -Wall -pedantic -std=c99 -fexpensive-optimizations
> -fomit-frame-pointer -frename-registers -Os
> -L/usr/local/openmoko/arm/arm-angstrom-linux-gnueabi/usr/lib -o
> inclinaison inclinaison.o
> inclinaison.o: In function `processInputEvents':
> inclinaison.c:(.text+0x128): undefined reference to `sqrt'
> collect2: ld returned 1 exit status

Here the linker complains about being unable to find the definition of
You need to add the math library (libm) in this command line, using
the "-lm" switch.

More information about the community mailing list