why we need different #include directives?

sorry, I’m an absolute rookie, I know my question is ignorant.

but I wonder why every time we need to use different #include directives to enable different supports from C++ library ??

Why not just let us use all supports from C++ library from the beginning?


Separating things into multiple header files keeps things simpler for the compiler and linker. The more code they have to process, the longer the compilation process will take. You don’t want them wasting efforts on code you are not interested in.

Also, using multiple header files is good for organization, keeping related functionality grouped together, allowing you more flexibility to cherry-pick only the functionality you actually want to use.