1、在公共头文件includes.h(新建的)中:
struct _Teststruct{
int a;
int b
};
extern _Teststruct teststruct;
2、在mainwindow.h中
struct _Teststruct teststruct;
3、在mainwindow.cpp中使用