Reputation: 12631
#include "Ser.h"
#include ".\ser.h"
Is this .\ser.h is an executable of Ser.cpp...When right clicked on it and when pressed "open the document .\ser.h" its going to the Ser.h file...
Why does they again include the executable file(./ser.h) as header file.... isnt the header file(Ser.h) enough to get all the delarations needed to be defined in.
Upvotes: 0
Views: 130
Reputation: 1885
The ./ser.h is not an executable file. Please keep in mind, file extensions ending in .h are generally header files.
If your platform is windows you will find executable files taking the file extension .exe.
One Ser.h file is enough to receive all the declarations, so you do not need two of the same header files.
Upvotes: 1
Reputation: 882716
.\ser.h
is not an executable file, it's simply another header file.
In systems where file names are case-irrelevant (and this seems likely here since it's using the Windows path separator \
), it may well be just including the same file twice.
If include guards are used correctly, that won't matter. If case is relevant, they're most likely two different files.
I say "may" since the order of searches for header files, and even the mapping of the header-names to headers or files, is implementation defined and xyz.h
and ./xyz.h
may be found in different places because of this.
Upvotes: 2
Reputation: 5230
There is no way of telling for sure without knowing what your include path is. This is likely just including the same header file twice on a case insensitive platform such as Windows. Which is probably a mistake but a harmless one because of include guards (those #ifdef
at the beginning and end of the file).
It seems as if you are having trouble understanding the purpose of header files. There is no such thing as the header file. A header file is just the place where functions and classes are declared but usually not defined. So if ser.cpp
uses some function that is defined in common_functions.cpp
, you should include the apropriate header - it will usually be called common_functions.h
.
Be aware that, as for almost anything in the C or C++ world, there are plenty of exceptions, but the above holds true most of the time.
Upvotes: 1