I am using an open source project (Open Scene Graph). I found that all the header file names are in File
format, which I found to be File With No Extension
It seems you are talking about this repository of C++ code.
It looks like the authors of that code decided to follow the patterns of the C++ standard library. In standard C++, library headers are not supposed to have the .h
extension. So the following is correct:
#include
With most implementations writing
would also work, but the version without an extension is actually correct. The C++ standard library was able to drop extensions in C++98 due to the introduction of namespaces, and introduction of the std
namespace for the standard library.
The C++ standard neither requires nor forbids an extension for other headers, so it's entirely up to the authors of some software what file extension to use, if any. The most common choices are to use .h
or .hpp
, the latter being intended to distinguish C++ headers from C headers.
A quick look at the OpenSceneGraph code shows that they've followed the C++ standard library pattern in their includes. There are no extensions, and everything is in the osg
namespace, analogous to the std
namespace of the standard library. So using the OpenSceneGraph libraries is very similar to using the C++ standard library.
#include // Provides osg::Camera
It's the same pattern as:
#include //Provides std::string
So I think it's safe to say that authors of the OSG wanted to follow the same pattern as in the C++ Standard Library. My personal opinion is that it's better to have a file extension, even if only to be able to search for header files.