Possible Duplicate:
Problem using pow() in C
Undefined reference topow' and
floor'
I am using gcc 4.6.1.
Code snippet:
int main(void)
{
int x= 2;
int y = pow(3,x);
printf("%d\n",y);
return 0;
}
Terminal:
avinash@titanic:~/Desktop/DSF$ gcc power.c -o power
/tmp/ccTJ7vAH.o: In function `main':
power.c:(.text+0x25): undefined reference to `pow'
collect2: ld returned 1 exit status
If I replace x by 2 then it gets executed in an expected way. Doesn't pow function accepts variables as it's parameters?
Note: I have included stdio.h and math.h in the source file.