"Undefined Reference" to pow and sqrt even though math.h header is there
Compiling this code tells me that there is no reference to pow() or sqrt(). The book didn't tell me under which header these functions are located but I assume they are under math.h. Am I missing something here?
Code:
#include <stdio.h>
#include <math.h>
double hypotenuse(double a, double b);
int main()
{
double side1, side2;
printf("Enter side 1: ");
scanf("%lf", side1);
printf("Enter side 2: ");
scanf("%lf", side2);
printf("%.2f\n", hypotenuse(side1, side2) );
return 0;
}
double hypotenuse(double a, double b)
{
return sqrt( pow(a, 2) + pow(b, 2) );
}