On Sun, 26 Jul 2009, LazyChild wrote:
Hi,everyone.
I am new here.
I have a problem. Today, I compile a gcc4.1.2 with mingw in WINXP.
I do not know the configure clearly, but I do a success. When I use g++
compile a "Helloworld",I surprisingly find that the exe is so big(3.55M).
I compile it like that :"g++ HelloWorld.cpp -o HelloWorld" and without "-g"
but gdb can really load it, and when I use gdb load it ,I find it has 748
lines.So many.
How can I compile a g++ like mingw , only product xxxkb...
Try using strip, part of the binutils package. This is what I did:
$ cat >hello.cpp <<EOF
#include <cstdio>
int
main()
{
printf("hello, world!\n");
}
EOF
$ i586-mingw32msvc-g++ hello.cpp -o hello.exe
$ i586-mingw32msvc-strip --strip-all hello.exe
The result is 4608 bytes using GCC 4.2.1. Note that I have not used the
C++ standard library, since GCC links elements of this library statically
into the executable, producing a much larger result.
See also: http://mingw.org/wiki/Large_executables
I hope you can help me! Thanks.
--
View this message in context: http://www.nabble.com/Why-do-g%2B%2B-compile-a-so-big-exe--tp24667450p24667450.html
Sent from the gcc - Help mailing list archive at Nabble.com.