title: Dynamically Loading QTGui
body: <p>I am writing a QT application and I wanted the compiled binary to be compatible with GUI and CLI(installed without X11) environments.</p>
  
  <p>The following is my main function which uses QApplication or QCoreApplication :</p>
  
  <pre><code>int main(int argc, char *argv[]){
      // SOME COMMON CODE will be executed before this
      bool myGUI = getenv("DISPLAY") != 0;
  
      if(myGUI){
          QApplication a(argc, argv);
          client w; // A MainWindow Object
          w.show();
          doStuff();
          return a.exec();
      }else{
          QCoreApplication a(argc, argv);
          doStuff();
          return a.exec();
      }
  
      return 1;
  
  }
  </code></pre>
  
  <p>Now, QT builds the binary having libQtGui as a dynamically shared object. I wanted to know if its possible to rather have the libQtGui loaded dynamically so that it can work in CLI environments without having to install all libraries required by libQtGui.</p>