Header with and without .h ending | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Header with and without .h ending

I always wondered why the c++ headers don't have the .h endings? On the other side I see it very often that .h is used for everything else (like in the c++ class for the examples).

7th Mar 2017, 6:49 PM
Ralf Beier
Ralf Beier - avatar
2 Answers
+ 9
Some compilers (like the one used here) allow you to leave the .h off for standard headers, but you always have to write it for custom class files. I know Borland compiler and some others make you write it in full regardless.
7th Mar 2017, 6:56 PM
Tamra
Tamra - avatar
+ 1
The c++ header files do not need .h, you need it for C headers your including. For example time.h is the C version an ctime is the C++ "remake" of time.h (it is not necessarily changed).
7th Mar 2017, 7:40 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar