Hey guys,

i'm making a program with a gui, due to ram and cpu specifications i need to put this program on a cluster and run it there. I cannot get gui support from the server through vpn. So im trying to make my app work as a gui or as a commandline program.

I can start the program from command line with the command(this is on linux):
"./imex" -> with gui
"./imex -nogui" -> withought gui

the thing im interested in, is the final if{nogui==false} below, why does my gui not show up on my testmachine if i run the ./imex command, if i dont run the nogui check ( the if {nogui==false} it will run fine).

Qt Code:
  1. #include "mainwindow.h"
  2. #include <QApplication>
  3. #include "imex.h"
  4. #include <SpiceUsr.h>
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. QApplication a(argc, argv);
  9.  
  10. qDebug() << "";
  11.  
  12. //start with gui if not specified
  13. bool nogui=false;
  14.  
  15. //check input arguments
  16. for (int i=1; i<argc; i++)
  17. {
  18.  
  19. if( strncmp(argv[i], "-nogui", 9) == 0)
  20. {
  21. nogui=true;
  22. //no gui support
  23.  
  24. imex guidata;
  25. qDebug() << "Input kernel location";
  26. QTextStream s(stdin);
  27. guidata.filepath_metakernel = s.readLine();
  28. qDebug() << "Path is: " << guidata.filepath_metakernel;
  29.  
  30. const char *c_str;
  31.  
  32. //QString -> C-String
  33. ba = guidata.filepath_metakernel.toUtf8();
  34. c_str = ba.data();
  35.  
  36. furnsh_c(c_str);
  37.  
  38. qDebug() << "No consol, not implemented";
  39. qDebug() << "";
  40. }
  41. }
  42. if(nogui == false)
  43. {
  44. qDebug() << "running gui";
  45. //run gui
  46. MainWindow w;
  47. w.show();
  48. }
  49. return a.exec();
  50. }
To copy to clipboard, switch view to plain text mode 

can someone explain what happens with the gui if i put the mainwWindow w; w.show(); in the if-brackets?