namespace Ui
{
class MathFunction;
}
class MathFunction : public QWidget
{
Q_OBJECT
public:
MathFunction(QWidget *parent = 0,QWidget *main_M=0);
~MathFunction();
Ui::MathFunction *ui;
private:
QWidget *main_Menu;
};
class MathFunctionLevelOne : public MathFunction
{
Q_OBJECT
public:
MathFunctionLevelOne(QWidget *parent = 0,QWidget *main_M=0);
~MathFunctionLevelOne();
};
MathFunctionLevelOne::MathFunctionLevelOne(QWidget *parent,QWidget *main_M):MathFunction(parent,main_M)
{ //a_Candidacy_ANSER是ui中的一个QLabel型窗口部件
MathFunction::ui->a_Candidacy_ANSER->setText("23");//会报错 错误如下
}
mathfunctionlevelone.cpp: In constructor ‘MathFunctionLevelOne::MathFunctionLevelOne(QWidget*, QWidget*)’:
mathfunctionlevelone.cpp:6: error: invalid use of incomplete type ‘struct Ui::MathFunction’
mathfunction.h:8: error: forward declaration of ‘struct Ui::MathFunction’//此处第8行是 Ui命名空间中class MathFunction部分
make: *** [mathfunctionlevelone.o] Error 1
为何出错?