C

Asked • 05/20/19

Why do you have to link the math library in C?

If I include `<stdlib.h>` or `<stdio.h>` in a C program I don't have to link these when compiling but I do have to link to `<math.h>`, using `-lm` with gcc, for example: gcc test.c -o test -lmWhat is the reason for this? Why do I have to explicitly link the math library but not the other libraries?

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.