Distinguish the difference between .h file with .hpp file .h file with .hpp file

  1. hpp, its essence is the realization of the code .cpp .h header files among mixed, definition and realization are contained in the same document, the class of the caller only needs to include the hpp file without the need cpp then added to the project in compiled. The implementation code will be compiled directly into the caller's obj file obj no longer generate a separate, hpp using cpp file will greatly reduce the number and frequency of compilation project, is no longer published annoying lib and dll, so it is suitable for the preparation of a common open source library.
  2. Header plus plus is too abbreviated
    and * .h Similarly, hpp header file is a C ++ program
    is dedicated VCL header files, precompiled
    header files in general template class
    in general, *. H there is only a statement, did not materialize, and * .hpp which has achieved statement, which can reduce the number of cpp.
  3. Note that the file can not contain hpp global objects and global functions
    because the caller is on hpp .h essentially include as the, or a global object there is global functions when hpp file, while the plurality hpp include caller is, when the link leads symbol redefinition error. To avoid this, it is necessary to remove the global object, the global function closure 

Guess you like

Origin www.cnblogs.com/fengtai/p/12501653.html