Sorry if this is dumm, but I am trying to use sqrtf
from gcc and get:
/tmp/cckMAaOo.o(.text+0x2c): In function `main':
: undefined reference to `sqrtf'
collect2: ld returned 1 exit status
What am I doing wrong? In man sqrt it says you need math.h
and double sqrt, float sqrtf
Here is the code
#include <stdlib.h>
#include <math.h>
main(){
double x=100;
float y=100;
// double sqrt(double x);
// float sqrtf(float x);
printf("sqrt of %f is %f \n",y,sqrtf);}
// printf("sqrt of %f is %f and of %f is %f\n",x,sqrt(x),y,sqrt);}
from gcc and get:
/tmp/cckMAaOo.o(.text+0x2c): In function `main':
: undefined reference to `sqrtf'
collect2: ld returned 1 exit status
What am I doing wrong? In man sqrt it says you need math.h
and double sqrt, float sqrtf
Here is the code
#include <stdlib.h>
#include <math.h>
main(){
double x=100;
float y=100;
// double sqrt(double x);
// float sqrtf(float x);
printf("sqrt of %f is %f \n",y,sqrtf);}
// printf("sqrt of %f is %f and of %f is %f\n",x,sqrt(x),y,sqrt);}