title: MinGW, build GUI application with console
body: <p>I'm using MinGW to build my application on Windows. When compiling and linking, the option "-mwindows" is put in command line to have Win32 API functions.</p>
  
  <p>To be more specific: when calling GCC of MinGW without "-mwindows" like this:</p>
  
  <pre><code>c:\&gt;g++ -c main.cpp 
  c:\&gt;g++ -o main.exe main.o
  </code></pre>
  
  <p>The 'main.exe' after the 2 command lines above will run with a console, and Win32 API functions won't be usable.</p>
  
  <p>When calling GCC of MinGW with "-mwindows" like this:</p>
  
  <pre><code>c:\&gt;g++ -c main.cpp
  c:\&gt;g++ -o main.exe main.o -mwindows
  </code></pre>
  
  <p>Now linking with '-mwindows', the 'main.exe' can use Win32 API, however, it doesn't start a console when the application runs.</p>
  
  <p>This "-mwindows" option disables the console, which makes me not able to print out debugging info. Any way to <strong>keep both console and the option '-mwindows'</strong>?</p>