title: GCC C++ "Hello World" program -> .exe is 500kb big when compiled on Windows. How can I reduce its size?
body: <p>I just recently started learning C++ - I am using <a href="http://nuwen.net/mingw.html" rel="noreferrer">nuwen's</a> version of MingW on Windows, using NetBeans as an IDE (I have also MSDN AA Version of MSVC 2008, though I don't use it very often).</p>
  
  <p>When compiling this simple program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int dog, cat, bird, fish;
  
  void f(int pet) {
    cout &lt;&lt; "pet id number: " &lt;&lt; pet &lt;&lt; endl;
  }
  
  int main() {
    int i, j, k;
    cout &lt;&lt; "f(): " &lt;&lt; (long)&amp;f &lt;&lt; endl;
    cout &lt;&lt; "dog: " &lt;&lt; (long)&amp;dog &lt;&lt; endl;
    cout &lt;&lt; "cat: " &lt;&lt; (long)&amp;cat &lt;&lt; endl;
    cout &lt;&lt; "bird: " &lt;&lt; (long)&amp;bird &lt;&lt; endl;
    cout &lt;&lt; "fish: " &lt;&lt; (long)&amp;fish &lt;&lt; endl;
    cout &lt;&lt; "i: " &lt;&lt; (long)&amp;i &lt;&lt; endl;
    cout &lt;&lt; "j: " &lt;&lt; (long)&amp;j &lt;&lt; endl;
    cout &lt;&lt; "k: " &lt;&lt; (long)&amp;k &lt;&lt; endl;
  } ///:~
  </code></pre>
  
  <p>my executable was about 1MB big. When I changed project configuration from <em>Debug</em> to <em>Release</em>, used -O1 -Os flags ( stripping debugging symbols along the way ), binary size was reduced from 1MB to 544KB.</p>
  
  <p>I am not a "size freak", but I am just wondering - is there any way, that I could reduce .exe size even more? I just think, that 544KB is just too much for such a simple application ). </p>