I need to use logs in a program for an assignment. I ran this test program on my machine to see how the log function works (and if it would), and I get the following error during build.
Code
/* log example */ #include <stdio.h> /* printf */ #include <math.h> /* log */ int main() { double param, result; param = 5.5; result = log (param); printf ("log(%f) = %f\n", param, result ); return 0; } ERROR
gcc -Wall -o "test" "test.c" (in directory: /home/linux/Development/codetest) /tmp/ccCDqX7x.o: In function `main': test.c:(.text+0x1b): undefined reference to `log' collect2: ld returned 1 exit status Compilation failed. Link
This is C99 code, grabbed from this tutorial site.