如何使用全局变量

1、在公共头文件includes.h(新建的)中:

struct _Teststruct{

int a;

int b

};

extern _Teststruct teststruct;

2、在mainwindow.h中

struct _Teststruct teststruct;

3、在mainwindow.cpp中使用

原文地址:https://www.cnblogs.com/judes/p/7359772.html