What is the purpose of creating object files separately and then linking them together in a Makefile?

前端 未结 4 2098
孤街浪徒
孤街浪徒 2020-12-11 18:57

When using the gcc compiler, it will link and compile in one step. However, it appears to be idiomatic to turn source files into object files and then link them at the end.

4条回答
  •  天命终不由人
    2020-12-11 19:21

    The two big reasons at the top of a list of many reasons for me are:

    • You can compile multiple source files at the same time decreasing build time
    • If you change one file, you only recompile that one file instead of recompiling everything

提交回复
热议问题