Cześć to znowu ja. Dzisiaj natknąłem się na pewien problem związany z przekazywaniem obiektu typu wyliczeniowego do funkcji pewnej klasy, oto kod:
//GameManager.hpp
enum PlayerMovementDirection
{
LEFT,
RIGHT,
JUMP,
ARE_NOT_MOVING
};
//...oraz stworzony obiekt tegoż typu, na razie niezainicjalizowany
PlayerMovementDirection playerMovementDirection;
//Player.hpp
//W tym pliku mam funkcję move o następującej deklaracji:
void move(const PlayerMovementDirection direction, const float FPS);
//a wywołuję ją tak:
player.move(playerMovementDirection, FPS);
Błędy są następujące:
Player.hpp:30:18: error: ‘PlayerMovementDirection’ does not name a type
void move(const PlayerMovementDirection direction, const float FPS);
^
In file included from GameManager.hpp:9:0,
from main.cpp:1:
Player.hpp:30:18: error: ‘PlayerMovementDirection’ does not name a type
void move(const PlayerMovementDirection direction, const float FPS);
^
In file included from Player.cpp:1:0:
Player.hpp:30:18: error: ‘PlayerMovementDirection’ does not name a type
void move(const PlayerMovementDirection direction, const float FPS);
^
Player.cpp:21:25: error: ‘PlayerMovementDirection’ does not name a type
void Player::move(const PlayerMovementDirection direction, const float FPS)
Zadeklarowanie klasy GameManager na początku pliku Player.hpp nie pomogło, jak i również używanie przedrostka GameManager, np. tak:
void move(const GameManager::PlayerMovementDirection direction, const float FPS);
Proszę o pomoc.