The C++ build system (compiler) knows no difference, so it’s all one of conventions.
The convention is that .h
files are declarations, and .cpp
files are definitions.
That’s why .h
files are #include
d — we include the declarations.
More Related Contents:
- Why is '#' symbol used in C language's header ? Why not any other symbol ? [closed]
- Redefinition C++ Issue, Multiple Header
- Using G++ to compile multiple .cpp and .h files
- C++ #include guards
- Splitting templated C++ classes into .hpp/.cpp files–is it possible?
- How to make a .lib file when have a .dll file and a header file
- Where does Visual Studio look for C++ header files?
- Tool to track #include dependencies [closed]
- C++ Redefinition Header Files (winsock2.h)
- How should I detect unnecessary #include files in a large C++ project?
- Headers Including Each Other in C++
- Change the current working directory in C++
- How to include header files in GCC search path?
- cstdio stdio.h namespace
- C++ Header Files, Code Separation
- Forward declare a standard container?
- *.h or *.hpp for your class definitions
- C++ Header order [closed]
- Difference between and ?
- Can I write C++ code without headers (repetitive function declarations)?
- Cyclic dependency between header files
- C++ class header files organization
- c++ template and header files [duplicate]
- Including C headers inside a C++ program
- static variables in an inlined function
- Where does gcc look for C and C++ header files?
- cmath vs math.h (And similar c-prefixed vs .h extension headers)
- Uses for anonymous namespaces in header files
- error: Class has not been declared despite header inclusion, and the code compiling fine elsewhere
- C++ templates declare in .h, define in .hpp