MSVS意外的类错误:虽然没有忘记分号

Bob*_*Bob 0 c++ class

在我的下面的代码中,我得到了这个编译器错误error C2236: unexpected 'class' 'Pawn'. Did you forget a ';'?但是你可以清楚地看到,我不会错过一个半冒号...是吗?我曾经认为这是一个问题,因为周期性的依赖性,但我删除了矢量旁边的任何包含.这个类也应该从我的Piece类继承,但即使删除后我仍然会收到错误.

#ifndef CHESS_PAWN_H
#define CHESS_PAWN_H

#include <vector>

class Pawn {
private:
    bool _hasMoved;

public:
    Pawn(int x, int y);
    ~Pawn();

    std::vector<int> availMoves();
};

#endif 
Run Code Online (Sandbox Code Playgroud)

我在这里做错了什么建议?

Han*_*ant 6

外推,你chess.cpp文件可能如下所示:

#include "piece.h"
#include "pawn.h"
//etc..
Run Code Online (Sandbox Code Playgroud)

丢失的分号位于piece.h中.标准预处理器损耗.