How to include all of the C++ Standard Library at once?

On some compilers, including <bits/stdc++.h> might do what you're looking for.

Note however that it makes your code nonportable (it may not work on other compilers, or even different versions of the same compiler). This is ok in some cases.

More info about why doing this might not be a good idea: Why should I not #include <bits/stdc++.h>?


Is there a singular preprocessor that I can add to my project to do both of these? Or do I just have to include both?

No there isn't and that's intentional. The standard library implementation should have a minimum of inter dependencies for the implemented components.

You should always specify the #include statements for the std components you use explicitly.


And don't be tricked by the infamous #include <bits/stdc++.h>.


You can use:

#include<bits/stdc++.h> 

as even suggested by everyone.But it is not a standard header file. The disadvantages of it are that it is

  • increases the compilation time.(As it includes all the header files together)
  • uses an internal non-standard header file of the GNU C++ library, and so will not compile in MSVC, XCode, and many other compilers