I've forked Stockfish's code and tinkering with the code.
My ultimate goal is to make xiangqi fork of stockfish.
I'm comfortable with C but new to C++.
Here's the stuff that confuses me:
I'm adding new data field to Position class:
Code: Select all
class Position {
public:
...
private:
// Data members
Piece board[SQUARE_NB];
Bitboard byTypeBB[PIECE_TYPE_NB];
Bitboard byColorBB[COLOR_NB];
int pieceCount[PIECE_NB];
Square pieceList[PIECE_NB][16];
int index[SQUARE_NB];
int castlingRightsMask[SQUARE_NB];
Square castlingRookSquare[CASTLING_RIGHT_NB];
Bitboard castlingPath[CASTLING_RIGHT_NB];
int gamePly;
Color sideToMove;
Score psq;
Thread* thisThread;
StateInfo* st;
bool chess960;
int newField;
Code: Select all
position.h:72:7: warning: type ‘struct Position’ violates the C++ One Definition Rule [-Wodr]
...
position.h:183:7: note: the first difference of corresponding definitions is field ‘newField’
int newField;
compiler thinks I'm having more than one definition of Position class.
How can I add new field to Position class without getting this warning?
Thanks in advance.