can someone help me with the #include being nested to deeply error before i go insane? thx [duplicate]

Solution 1:

Player.h includes Game.h and Game.h includes Player.h. This is an infinite loop. There might be more, but that's just the first one I saw.

You should remove at least one of those includes to break the infinite loop. If you get errors when you do that, you might be able to fix them using a forward declaration that looks something like this:

class Player;

A forward declaration like that would allow you to compile some code that uses the Player class, even though a complete definition of the Player class is not available at that point in the program.

Two more tips to make things more sane:

  • Put your include guards at the very top of your file before you include anything.
  • Use #pragma once as the include guard instead of your more complicated thing.