title: Bloated EXE sizes, and unwanted dependencies with Qt/MingW
body: <p>I'm trying to figure out how to shrink the sizes of EXE files compiled under the newest QT SDK (4.8.2) (mingw/g++ based).  I was working on a vanilla c++ console app that has a simple loop and only #includes iostream, when I noticed that the exe's it generated are about 465kb; way bigger than they should be!  Commenting out all the stream stuff brings it down to the expected 5kb range (although the remaining code would be mostly dead).   This doesn't seem right at all, especially since another, full project I'm working on has a QGLwidget, windowing, a dozen data structures and ~3000 statements and only clocks in at about 126Kb.  Is there some setting or flag I'm missing?  Here's the .pro, while the cpp is trivial and Qt-free (basically getline and cout with a half dozen char swaps):</p>
  
  <pre><code>TEMPLATE = app
  CONFIG += console
  CONFIG -= app_bundle
  CONFIG -= qt
  SOURCES += main.cpp
  QMAKE_CXXFLAGS_RELEASE += -O2
  QMAKE_CXXFLAGS_RELEASE += -Os
  </code></pre>
  
  <p>I've tried a few other configurations, and it's definitely compiling in release mode (debug is >3Mb), but I can't figure out why it's so bloated.</p>
  
  <p>I've also looked at the PE header, and I see that it's importing some functions from libgcc_s_dw2-1.dll and mingwm10.dll, and it'd be nice if I could eliminate those dependencies altogether as well, especially since neither one should be required anyway.  I can make the libgcc one go away(at the expense of 17kb of exe size) by adding <code>QMAKE_LFLAGS_RELEASE += -static</code> to the .pro, but the mingwm10.dll stays either way, calling a single function.</p>
  
  <p>Based on the overall bloating, and all the useless framework stuff that the compiler is trying to sneak in (networking, at least).  I'm guessing it's just a matter of a couple settings that are askew, particularly with some of the default compiler flags like -DQT_LARGEFILE_SUPPORT or -mthreads. Here is the compile output (bullets added for emphasis):</p>
  
  <ul>
  <li>14:04:00: Running steps for project conTest...</li>
  <li>14:04:00: Configuration unchanged, skipping qmake step.</li>
  <li>14:04:01: Starting: "C:\QtSDK\mingw\bin\mingw32-make.exe" </li>
  <li>C:/QtSDK/mingw/bin/mingw32-make -f Makefile.Release</li>
  <li>mingw32-make[1]: Entering directory `C:/Documents and Settings/Administrator/My Documents/QT/conTest'</li>
  <li>g++ -c -O2 -O2 -Os -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.8.1\mingw\mkspecs\win32-g++" -o release\main.o main.cpp g++ -Wl,-s -Wl,-subsystem,console -mthreads -o release\conTest.exe release/main.o</li>
  <li>mingw32-make[1]: Leaving directory `C:/Documents and Settings/Administrator/My Documents/QT/conTest'</li>
  <li>14:04:10: The process "C:\QtSDK\mingw\bin\mingw32-make.exe" exited normally.</li>
  </ul>