Hi all
I have some troubles with pow function and <math.h> in Code:Blocks.
My code:
#include <stdio.h>
#include <math.h>
int main(void)
{
struct okrag /* definicja struktury*/
{
float x,y, promien;
char kolor[20];
};
struct prostokat
{
float x1,y1,x2,y2;
char kolor[20];
};
struct okrag o1,o2; /*deklaracja struktur typu okreg*/
printf("Insert r1 and R1: ");
scanf("%f %f %f", &o1.x, &o1.y, &o1.promien);
printf("Insert r2 and R2:");
scanf("%f %f %f", &o2.x, &o2.y, &o2.promien);
/*obliczenie ogleglosci pomiedzy srodkami okregow:*/
float odleglosc = sqrt((pow (o1.x-o2.x), 2)+ pow ( (o1.y-o2.y), 2));
if (odleglosc <=(o1.promien+o2.promien))
printf ("Okregi maja czesc wspolna. \n");
else if (odleglosc=(o1.promien+o2.promien))
printf ("Okregi sa styczen");
else
printf("Okregi sa rozlaczne. \n");
return 0;
}
(some comments are in Polish)
Now:
~~\test1.c||In function 'main':|
~~\test1.c|26|error: too few arguments to function 'pow'|
||=== Build finished: 1 errors, 0 warnings ===|
BUT, when i pasted that code into Linux terminal and used gcc with [-lm] parameter, there were no errors.
My question is: can U tell me how to add that parameter to compiler in C:B? (or make my code working).
Best wishes,
Strykul