1 Answer
1

You're right that you'll end up with the same executable at the end (albeit with a different name); in the first case gcc will actually create a bunch of temporary object files that it removes after linking, versus the second case where you're making the object files yourself.

The main reason to do things the second way is to allow for incremental building. After you've compiled your project once, say you change Something.cpp. The only object file affected is something.o -- there's no reason to waste time rebuilding the others. A build system like make would recognize that and only rebuild something.o before linking all the object files together.