compilation error related to math.h inclusion


if i include math.h and use any of the math function like sin,cos etc., it shows “undefined reference” error, eventhough when i include “math.h” header.

please help.


You need to specify inclusion of the math library during link. If you’re dynamic linking make sure the math library is on the target.

In other words, you should have “-lm” on the compile line, e.g.

qcc -o myprog myprog.c -lm

-James Ingraham
Sage Automation, Inc.

thans for ur replies after including the dynamic library the linking issue solved