Search code examples
cgcclibrariesstatic-linking

Is the math library linked statically?


I was under the impression that the math library is linked statically because -l name links to libname.a, however if I try to compile with the -static flag, suddenly GCC can't find the math functions.

Does this means that math is not necessarily linked statically? Or is something else is going on here?


Solution

  • If it would compile statically you would write gcc libname.a instead of gcc -l libname.

    And to your question, yes math library is linked dynamically.