Got my notebook reset today, re-installed Ubuntu and got this strange problem... Everytime I try to run pow, sin, cos and tan it gives me this warning in the terminal:
/c/"testmath
/usr/bin/ld: /tmp/ccauzwsW.o: in function `main':
testmath.c:(.text+0x34): undefined reference to `pow'
/usr/bin/ld: testmath.c:(.text+0x47): undefined reference to `sin'
/usr/bin/ld: testmath.c:(.text+0x5a): undefined reference to `cos'
/usr/bin/ld: testmath.c:(.text+0x6d): undefined reference to `tan'
collect2: error: ld returned 1 exit status
I have no idea what could've caused it. Also, when I insert a value directly in the function like y = pow(100, 2) it appears in the terminal perfectly, the problem really occurs when I reference other variable, like sqrt(x) for example.
Here's the code I'm using for tests:
#include <stdio.h>
#include <math.h>
int main(void){
float z ,x = 9.0, y, k, l, m ;
y = sqrt(9.0);
z = pow(x , 2);
k = sin(x);
m = cos(x);
l = tan(x);
printf("\nThis is the sqrt: %f\n", y);
printf("\nThis is the pow: %f\n", z);
printf("\nThis is the sin: %f\n", k);
printf("\nThis is the cos: %f\n", m);
printf("\nThis is the tan: %f\n", l);
return 0;
}
I'm currently running Ubuntu 20.04 x64 and VSCode with the C/C++ extensions, if that helps.