Hi,
I am writing an application consisting of some files that do inherit from a common base class "Piece". When I try to instantiate an object based on "Piece" inside another class that is also based on "Piece" I get an error like this: "... was not declared in this scope".
I can however instantiate objects from these classes inside other non-related classes. Creating a minimal compilable piece of code to highlight that problem would involve changing the whole code base (bad design :-s) so I just wanted to know if anybody here is able to quickly spot the problem. you can get the sources from here: http://gitorious.org/shatranj/shatranj/trees/master (There is a Download master as tar.gz button on the right side of the page.) Compiling it involves: qmake && make


Here is a piece of code that highlights the problem in "king.cpp"

Qt Code:
  1. #include "king.h"
  2. #include "chessboard.h"
  3.  
  4. // Qt
  5. #include <QPair>
  6. #include <QDebug>
  7.  
  8. #include "rook.h"
  9.  
  10. King::King(ChessBoard const* board, Color color, int file, int rank)
  11. : Piece(board, Piece::King, color, file, rank)
  12. , m_hasMoved(false)
  13. {
  14. Rook* r;
  15. }
  16.  
  17. ...
To copy to clipboard, switch view to plain text mode 

If you remove Rook* r; the code will compile without any further issues. Can anybody tell me what I am doing wrong?

Thanks in advance