當我編譯有錯誤調用「錯誤C2061:語法錯誤:標識符‘球員’」什麼是「錯誤C2061:語法錯誤:標識符」?
我無法弄清楚什麼是錯我的代碼。這裏是我的代碼
#include "Platform.h" #include "Player.h" class Collision { public: Collision(void); ~Collision(void); static bool IsCollision(Player &player, Platform& platform); };
有一個在 「IsCollision」 方法的錯誤。
Player.h
#include <SFML/Graphics.hpp>
#include "rapidxml.hpp"
#include <fstream>
#include <iostream>
#include "Collision.h"
using namespace rapidxml;
class Player
{
private:
sf::Texture playerTexture;
sf::Sprite playerSprite;
sf::Vector2u position;
sf::Vector2u source;
sf::Vector2u size;
int frameCounter, switchFrame, frameSpeed;
int walkSpriteWidth;
float velocity;
bool isWalk;
bool isStand;
bool isFaceRight;
public:
Player(void);
~Player(void);
void Init();
void Draw(sf::RenderWindow *window);
void MoveForward();
void MoveBackward();
void Update(sf::Clock *clock);
void SetSourceY(int value);
void SetWalk(bool value);
void SetFacing(std::string value);
void SetStand(bool value);
void Stand();
std::string GetStatus();
void PrintStatus();
sf::Vector2f GetPosition();
int GetWidth();
int GetHeight();
};
向我們展示你的'Player.h',請 –
最有可能的是,'Player'在另一個命名空間中,或者更可能的是''Player.h'包含了包含這個代碼的頭文件。 –
@KirilKirov後者似乎更可能(鑑於這是一個非常常見的錯誤)。您應該將其作爲答案發布。 –