#include <stdio.h>#include <math.h>int exp_for_level(int n) { return (int)(100 * pow(n, 2.3));}int main(){ int x; x = exp_for_level(6); printf("%d", x); return 0;}
I receive the following error when I run this code on an online compiler
/tmp/cc28S7ML.o: In function exp_for_level':main.c:(.text+0x19): undefined reference to `pow'collect2: error: ld returned 1 exit status
How do I rectify this?
After I couldn't get it to work on the online compiler, I followed advice from some other threads on The file is stored under a file grades.c on my macI've tried entering this
$ gcc - Wall - lm -o grades grade . c
into my terminal and i just get zsh error: command not found
Any ideas on what the issue is here too?The online compiler I'm using is https://www.tutorialspoint.com/compile_c_online.php
EDIT: in my post, in main I'd miswritten the function as exp_to_level instead of exp_for_level. Didn't copy paste the entire code as it's too long. I narrowed it down and retyped it to the portion that yields the error.