This only applies to homemade headers. I use the usual
The construct is designed to prevent multiple definitions from system headers, that may well be included by "other" system headers ... depending on what your package, or what you are including.
It sounds like the error is occurring at link time, as would occur, if your including the same header in each unit your compiling.
Try including it in one unit only, such as the unit that your using as your "main" source file, the one containing the main function.
Then i'd have another header full of "extern" declarations, as suggested above ... to let the linker know that a declaration exists for the types in one of the other objects. That you would include in every source unit that you intend to use a type in. Safe enough to include it everywhere. Except for the one that has the original inclusion in.
If your just compiling a single home-rolled source file, then it wouldn't be a problem.
g++ complains that it gets declared in every file that includes the header! Madness!
, quite correct behaviour. And it does suggest your are actually including it it a number of files. So the result is to be expected.
As stated though, if that same header was being included by a number of other headers that were being included in a single unit, then it would prevent its' multiple inclusion. As per its' purpose and extensive use by the system headers.
It can be a pain though, i know