c++class

MSVS unexpected class error: Didn't forget the semicolon though


In my code below, I get this compiler error error C2236: unexpected 'class' 'Pawn'. Did you forget a ';'? But as you can see plainly, I'm not missing a semicolon... am I? I used to think it was a problem due to cyclical dependencies, but I removed any includes beside the vector. This class was also supposed to inherit from my Piece class, but even after removing that I still get an error.

#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 

Any advice on what I'm doing wrong here?


Solution

  • Extrapolating, you chess.cpp file might look like this:

    #include "piece.h"
    #include "pawn.h"
    //etc..
    

    The missing semicolon is located in piece.h. Standard preprocessor lossage.