I was attempting to use the math routines of the libc library. The following program (listed below), would not compile. A shell session, showing error messages, follows the source code.
Source code: #include <stdio.h> #include <math.h>
int main (void) { printf("The square root of 2.0 is: % .6f\n", sqrtf(2.0)); }
Shell session showing error message: $ gcc -o example example.c /tmp/cc4fVMFv.o: In function `main': /tmp/cc4fVMFv.o(.text+0x12): undefined reference to `sqrtf' collect2: ld returned 1 exit status $
Setting path and and gcc environment variables did not make the program compile. Is this feature (math.h), fully implemented or, unsupported or, depreciated? Please, tell me what to do to get this program to work.
-Ihor