In the video of compiler, we have to link the math library with hello.o with with the -lm flag. Why don't we have to link stdio library with hello.o?

2 Answers 2


because, unlike the math library, the standard library is linked by default unless you tell the compiler that you don't want that to happen, which isn't usually what you need.


Explicitly linking of library is only needed if you are using a non-standard library in your program such as math.h and cs50.h. Standard libraries such as stdio.h, stdlib.h, string.h, ctype.h etc. are by default linked in the linking step in the compilation process. Hope this answers your question.

  • header files are not libraries per-se!
    – kzidane
    Commented Dec 9, 2015 at 9:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .