When trying to compile C code that includes math funcions like sqrt or pow terminal displays this error:
This is the code:
#include <stdio.h>
#include <math.h>
void main()
{
int x1, y1, x2, y2, dx, dy;
float c;
printf("\nUpisite koordinate tacke A(x1 i y1): ");
scanf("%d%d", &x1, &y1);
printf("\nUpisite koordinate tacke B(x2 i y2): ");
scanf("%d%d", &x2, &y2);
dx = x2 - x1;
dy = y2 - y1;
c = sqrt((dx*dx) + (dy*dy));
printf("\nDve tace su udaljene %2.f", c);
return;
}
My classmate suggested that is is an error with linux and that I should add -lm at the end of terminal but I am trying to make this work in VSCode.