I remembered to add the “#ifndef” stuff to my Character class as soon as I realized I was going to need to “#include” character.h when I setup the Character* pointer in my Enemy class.
So far so good.
But the problem is that since I’m not “#including” the character.h stuff again, I’m getting all kinds of errors in character.cpp when it tries to “#include” character.h.
This is the instructor's code:
character.h:
This is my code:
character.h:
character.cpp:
Q:
Is there a way to ensure it’s only #included twice and only at these parts? Should I define more variables somewhere? How come the instructor’s code isn’t having this same problem.
Like me, he also “#includes” chartacter.h in two important places: main.cpp and character.cpp
Instructor's main.cpp #includes:
My main.cpp #includes:
Not sure what I’m doing that’s dramatically different.
Also, and maybe I should have pointed this out earlier (no pun intended), but the game runs fine if I hit F5. These errors that VSCode is showing don’t seem to be influencing gameplay at all, which I also do not understand.