我正在实施纸牌游戏。我希望窗口ui成为 class 的对象Rule,以便Rule可以直接修改 GUI。  
在构造函数中初始化Rule的对象也是如此。Window * ui
但是在编译过程中,编译器告诉我rule.h,“窗口尚未声明”,“窗口不是类型”。我包括在内<window.h>,所有内容都具有相同的类型,所有内容都已初始化,所以我想不出它为什么不起作用。
编辑:我按照 alexisdm 的注释编辑了代码。另外, in rule.h,我不得不将uifrom的定义Window * ui改成Ui::Window *ui,因为 in window.h,ui被定义为Ui::Window * ui,这就是我要Rule::rule控制的对象。
但是现在,在rule.cpp中,ui->do_stuff()并没有编译,因为Ui::Window没有do_stuff()功能,但是Window...
精氨酸!该怎么办?!!ui->do_stuff() 在 window.cpp 中工作正常。继承问题?
窗口.cpp:
    Window::Window(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Window)
{
    ui->setupUi(this);
    player = new Game_state();                  /* Game state                   */
    rule = new Rule(player, ui);                /* Implement the action of cards*/
}
void Window::do_stuff(){
//Do stuff
}
窗口.h
#include <QDialog>
#include "game_state.h"
#include "rule.h"
class Rule;
namespace Ui {
    class Window;
}
class Window : public QDialog
{
    Q_OBJECT
public:
    explicit Window(QWidget *parent = 0);
    ~Window();
    Game_state      * player;
    Rule            * rule;
    void do_stuff();
private:
    Ui::Window *ui;
};
规则.h
#ifndef RULE_H
#define RULE_H
#include "window.h"
#include <game_state.h>
class Window;
class Rule{
public:
    Rule(Game_state *, Ui::Window *);
    void action(Card *);
private:
    Game_state * player;
    Ui::Window     * ui;
};
#endif // RULE_H
规则.cpp
    #include <rule.h>
    Rule::Rule(Game_state * game, Ui::Window * window){
        player = game;
        ui = window;
    }
    void Rule::stuff(){
        ui->do_stuff();
    }