Why is it that compiled programming languages (C++ for example) are set up to create many object files that are linked together as opposed one large object being created?
For example (written in C++, could apply to any compiled language), consider two files in a project
auxiliary.cpp. What is the difference between
auxiliary.cpp being compiled to
auxiliary.o and then linked to
main.cpp with a
#include auxiliary.cpp being compiled to only
main.o and linked to
main.exe? To my knowledge, these would at least superficially produce the same result.
I see the necessity for multiple objects in the case of multi-language projects, but not otherwise. Does multiple objects somehow give the linker more flexibility in creating an executable?