The problem is this. I have a Level class, where there is a method of colliding with a map, it is common both for the player and for the enemies. And the class of enemies, where this method is called, because the enemy must run at the level (like the player).
As a result, I ran into the problem of declaring classes when using the class method BEFORE the description of the class itself. You could just swap the Entity and Level classes. But I want to keep a list of enemies in the Level class (if only because they are stored with the Tiled Map Editor level).
class Entity { public: bool solid = true, visible = true; void update(Level& level) { level.col(*this); } Entity() {} }; class Level {public: Level() { std::list <std::shared_ptr<Entity>> enemy; enemy.emplace_back(new Entity()); } void col(Entity& player) { } }; int main() { Level level; } When compiling swears on an undeclared identifier.