如何使用全局变量

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

struct _Teststruct{

int a;

int b

};

extern _Teststruct teststruct;

2、在mainwindow.h中

struct _Teststruct teststruct;

3、在mainwindow.cpp中使用

 

posted @ 2017-08-14 19:25  朱小勇  阅读(753)  评论(0编辑  收藏  举报