I was working with pow() function in c using vscode. And I want to use a variable in exponent parameter of power function i.e. pow (2, i). But i was getting error so, I used gcc programName.c -lm during compilation in terminal. Is there any way by which I can use normal compilation command like gcc programName.c and get output of program with same problem.
n = 10;
h = 0;
while (n > pow(2, h))
h++;
printf("\n%d\n", h);
error:
/tmp/ccptU1ZR.o: In function main':
BinaryTree.c:(.text+0xd9): undefined reference to
pow'
collect2: error: ld returned 1 exit status
The terminal process terminated with exit code: 1
expected output : 4