So, I'm working on a project and I have a header file simpleCommand.hh
that I need to reference in two other headers. I have included simpleCommand.hh
in command.hh
and builtin.hh
. Now, builtin.hh
is included in command.cc
which also includes command.hh
, so g++ is telling me that the struct SimpleCommand
is being defined twice. However, if I remove simpleCommand.hh
include from builtin.hh
, g++ tells me that SimpleCommand
hasn't been defined when I use it in builtin.hh
.
Here's the weird part: if after doing all this, I go into builtin.hh
and re-add include "simpleCommand.hh"
, the program compiles fine. However, randomly if I try to compile at another point in the future, g++ will give me this error again and I have to start the process over.
Am I missing something here?