Someone said you could write a static class and call it.
But I just wondered if I could use a global varieties to initialize my program.
Here is the code:
Qt Code:
  1. extern int var_name ;
  2. void MainWindow::function_name_1()
  3. {
  4. int var_name;
  5. var_name=1;
  6. };
  7. void MainWindow::function_name_2()
  8. {
  9. some_other_function(var_name);
  10. };
To copy to clipboard, switch view to plain text mode 
The compiler says may be used uninitialized in this function.
So how to fix it?Anyone could give me some suggestions to use the global vars?