title: Console output in a Qt GUI app?
body: <p>I have a Qt GUI application running on Windows that allows command-line options to be passed and under some circumstances I want to output a message to the console and then quit, for example:</p>
  
  <pre><code>int main(int argc, char *argv[])
  {
    QApplication a(argc, argv);
  
    if (someCommandLineParam)
    {
      std::cout &lt;&lt; "Hello, world!";
      return 0;
    }
  
    MainWindow w;
    w.show();
  
    return a.exec();
  }
  </code></pre>
  
  <p>However, the console messages do not appear when I run the app from a command-prompt.  Does anyone know how I can get this to work?</p>