Is it possible to link to the math library from inside the C source code in gcc? Is it possible to link to the math library from inside the C source code in gcc? unix unix

Is it possible to link to the math library from inside the C source code in gcc?


The usual way to simplify complication for the user (or indeed for the developer) is to write a makefile.


First, it's gcc -lm and no there is no #pragma meant to give linking directives


No, you need to tell the linker to link the library in order to link the library.

The linker doesn't know about the code, only the compiled object files. It won't see a language specific pragma.