Header with and without .h ending | Sololearn: Learn to code for FREE!

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).

3/7/2017 6:49:08 PM

Ralf Beier

2 Answers

New Answer

+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.

+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).