Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22091

GCC C++"Hello World" program -> .exe is 500kb big when compiled on Windows. How can I reduce its size?

$
0
0

I just recently started learning C++ - I am using nuwen's 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).

When compiling this simple program:

#include <iostream>using namespace std;int dog, cat, bird, fish;void f(int pet) {  cout << "pet id number: "<< pet << endl;}int main() {  int i, j, k;  cout << "f(): "<< (long)&f << endl;  cout << "dog: "<< (long)&dog << endl;  cout << "cat: "<< (long)&cat << endl;  cout << "bird: "<< (long)&bird << endl;  cout << "fish: "<< (long)&fish << endl;  cout << "i: "<< (long)&i << endl;  cout << "j: "<< (long)&j << endl;  cout << "k: "<< (long)&k << endl;} ///:~

my executable was about 1MB big. When I changed project configuration from Debug to Release, used -O1 -Os flags ( stripping debugging symbols along the way ), binary size was reduced from 1MB to 544KB.

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 ).


Viewing all articles
Browse latest Browse all 22091

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>