hi!
I just recently started working in linux red hat 9.0 to compile my C programs , I am using the gcc command but the program is giving me weird errors and does not recognize the functions ceil(), floor() and sqrt(), I have tried and added most header files like math.h nad stdlib.h along with stdio.h but I keep getting wried errors like :
/tmp/ccqz1JFE.o(.text+0xba): In function `main':
: undefined reference to `sqrt'
collect2: ld returned 1 exit status
The program is as follows
Code:
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
double i, j, k;
for(j = 0.0; j < 1.0; j += 0.1)
printf("%8.1f", j);
printf("\n");
for(i = 0.0; i < 10.0; i += 1.0)
{
for(j = 0.0; j < 1.0; j += 0.1)
{
k = i + j;
printf("%8.1f", sqrt(k));
}
printf("\n");
}
return 0;
}