Tuesday, July 20, 2010

undefined reference to `pow' collect2: ld returned 1 exit status


In Linux GCC compiler when we compile a c program may get error message:

Error message: undefined
reference to `pow' collect2: ld returned 1 exit status

Compiler:
Linux gcc



Solution:



Cause of this error is
by default math.h library has not included. So compile the c code in following
way:



[root@localhost ~]# gcc
abc.c -lm



Note: Here abc.c is name
of any c code file.

No comments:

Post a Comment