mma1480
mma1480

Reputation: 709

Combining Header files for a library

I was wondering, when making your own static library, is it a good idea to combine all the header files into one wrapper header file? For example, let say I have a bunch of *.h and *.cpp files, which I compiled into *.lib files. Is it good practice to make a wrapper header file, so when I write include, I only have to include one header, which will include everything else, which I may or may not need. Does this bloat up the *.exe file, which would have been linked to the library file with the stuff that wasn't being used?

Upvotes: 5

Views: 1456

Answers (1)

Aamir
Aamir

Reputation: 15576

If it is a static library, it is going to become part of exe anyway whether you make it one header or several headers. However, from a design perspective, it is better to keep headers separate so that the user of that lib includes only the headers that he specifically needs.

Upvotes: 5

Related Questions