Cześć, nie mogę skompilować tego kodu przy użyciu cmake
, jak dodać do niego -lm
?
#include <math.h>
#include <stdio.h>
int main() {
int side;
printf("Enter the value of side: ");
scanf("%d", &side);
printf("The value of area is %d", pow(side, 2));
}
undefined reference to `pow'
collect2: error: ld returned 1 exit status
Tak działa
gcc -o test main.c -lm