bunny1
February 28th, 2012, 11:42 AM
Can anyone please tell me why the following code gives errors ? Iv tried changing the code but got nowhere. Im on Xubuntu with GCC.
#include <math.h>
#include <stdio.h>
int main()
{
int i=2;
printf( "%f\n", pow(i,2) );/* This fails if 2 is any higher ? */
return 0;
}
The error is..........
In function `main':
test1.c: (.text+0x23): undefined reference to `pow'
collect2: ld returned 1 exit status
#include <math.h>
#include <stdio.h>
int main()
{
int i=2;
printf( "%f\n", pow(i,2) );/* This fails if 2 is any higher ? */
return 0;
}
The error is..........
In function `main':
test1.c: (.text+0x23): undefined reference to `pow'
collect2: ld returned 1 exit status