[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

C compiler.



hello all,
i'm trying to compile (gcc filename.c) the following program, but it seems
math.h isn't being found.

this is the error:
/tmp/ccCw1SMR.o: In function `main':
/tmp/ccCw1SMR.o(.text+0x52): undefined reference to `pow'
collect2: ld returned 1 exit status


#include <stdio.h>
#include <math.h>

main()
{

const float probability_year_1 = 0.94, 
probability_year_2 = 0.82, 
interest_rate = 8.5;

float monthly_premium, 
common_term, amount;


amount = 20000;
common_term = 1 + interest_rate/100;
monthly_premium = amount/12 * (probability_year_1/common_term +
probability_year_2/pow(common_term, 2));

printf("Using investment rate = %.1f\n", interest_rate);
printf("For %.0f insurance\n", amount);
printf("Monthly premium is %.2f\n", monthly_premium);

}

any ideas whats wrong?
-- 
cheers,
paul



Reply to: