c++ - Why do we need compiling and linking separately? -


is possible link @ time of compiling, , remove separate linking step?

you compile 1 or more translation units @ time, far language concerned each tu considered in isolation when compiling. link 1 or more translation units together.

so, if tus in program compiled @ same time, can link them @ time (well, linking after compilation, that's internal detail , there's nothing stop writing compiler/linker somehow interleaves steps there's no single point occurs after compilation has finished before linking starts).

however, if compile 1 tu out of many later linked make program, of course cannot link @ same time. link what? other tus might not have been written yet, if tu compiling distribution staticly-linked library.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -