I've seen this done before in various C++ libraries - namely Qt (QtCore, QtGui, etc.) and Irrlicht (irrlicht.h):
// file - mylibrary.h
#include "someclass1.h"
#include "someclass2.h"
#include "someclass3.h"
// and so on...
Obviously this exists for convenience - a programmer wishing to use the library only has to include one header instead of lots of different ones. My question is, is there a special name for this type of header file? Even if there's not an "official" name, what you you refer to it as? A "convenience header" or "module header" or something?
Names given so far (with sources):
User contributions (no sources):
You make the declarations in a header file, then use the #include directive in every . cpp file or other header file that requires that declaration. The #include directive inserts a copy of the header file directly into the . cpp file prior to compilation.
Yes, this will work. Note, however, that if you include a lot of headers in this file and don't need all of them in each of your source files, it will likely increase your compilation time.
You request to use a header file in your program by including it with the C preprocessing directive #include, like you have seen inclusion of stdio. h header file, which comes along with your compiler.
There are of 2 types of header file: Pre-existing header files: Files which are already available in C/C++ compiler we just need to import them. User-defined header files: These files are defined by the user and can be imported using “#include”.
That's a nice question :)
I've found some sources that call it master header file, e.g:
When it is used to host headers for the header precompiler, it could be called precompiler global header:
However I don't think that there's a single widespread way to call it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With