Why do you need different files on large programs?

Just wondering why you would need multiple files on large programs and what they could be used for.
What? You don't.
Last edited on
Are you talking about splitting up the source into a number of .cpp and .h files?

Or about splitting an application up into the main app, dynamic libraries/shared object and static libraries?


PS I believe you need both in a large project.

Of course, from the C++ language point of view it doesn't matter whether absolutely everything is stuffed in one humongous .cpp file or split up into several. It will compile to more or less the same code (splitting up an app so it uses dynamic libraries/shared object will affect the final binary). But that's not the whole story. The thought of using a single .cpp file for a full scale project is totally unthinkable!
Last edited on
Any time you compile a project only the files that are changed from the previous compile need to be re-compiled. By splitting a project up into multiple source and header files you reduce the amount of work the compiler needs to do if you only change a few files. Also, if you are only looking to change one class, or a function, or something else rather small, you don't need to look through all the code to locate what you want to change, you only need to find the particular headers/source files that contain what you need to change.
say you have a large project, you might work on 2 files, while someone else might work on 2-3 and so forth.

It's easier to make changes to a small file than single large one.
well at least when problems occur.
Topic archived. No new replies allowed.