Should Includes Be in Header or Cpp?
2 Answers. in General, You Should Only Include Headers In. H Files That Are Needed by Those Headers. in Other Words, If Types Are Used in a Header and Declared...
2 Answers. In general, you should only include headers in . h files that are needed by those headers. In other words, if types are used in a header and declared elsewhere, those headers should be included.
Should you put includes in header file?
A header file should be included only when a forward declaration would not do the job. The header file should be so designed that the order of header file inclusion is not important.
Should headers include other headers?
4.3 A header file must be self-contained and self-sufficient. ... Must include all other headers and/or forward declarations it needs to be compiled standalone. In addition, a file should not rely on symbols defined in other header files it includes; the other files should be included explicitly.