title: How to get ride of console box of a GUI program compile by MinGW + Code::Block
body: <p>When I compile and run a simple Win32 GUI program in MinGW+MSys with command line:</p>
  
  <p><code>$ g++ main.cpp -o app -std=c++0x</code></p>
  
  <p><code>$ ./app</code></p>
  
  <p>only a dialog box shows. But when I put this program into Code::Blocks IDE and compile it, it always results in a black console box with the dialog. Adding <code>-mwindows</code> in link options no effect.</p>
  
  <p><strong>main.cpp:</strong></p>
  
  <pre><code>#include &lt;windows.h&gt;
  int WinMain(HINSTANCE,HINSTANCE,LPSTR,int)
  {
      MessageBox(0,"Hello, Windows","MinGW Test Program",MB_OK);
      return 0;
  }
  </code></pre>
  
  <p>How can I get rid of the console box?</p>