From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2774 invoked by alias); 25 Sep 2004 19:41:10 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 2767 invoked from network); 25 Sep 2004 19:41:09 -0000 Received: from unknown (HELO main.gmane.org) (80.91.229.2) by sourceware.org with SMTP; 25 Sep 2004 19:41:09 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1CBIPs-00041o-00 for ; Sat, 25 Sep 2004 21:41:08 +0200 Received: from 150-coru-x12.libre.retevision.es ([62.83.49.150]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 25 Sep 2004 21:41:08 +0200 Received: from ofv by 150-coru-x12.libre.retevision.es with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 25 Sep 2004 21:41:08 +0200 To: gcc@gcc.gnu.org From: Oscar Fuentes Subject: Re: Reducing the size of the binaries Date: Sat, 25 Sep 2004 21:51:00 -0000 Message-ID: References: <20040925175040.GA67405@cs.huji.ac.il> <20040925190401.87589.qmail@web53210.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@sea.gmane.org Cc: jigarzon82-chan@yahoo.com.ar X-Gmane-NNTP-Posting-Host: 150-coru-x12.libre.retevision.es User-Agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3.50 (windows-nt) X-SW-Source: 2004-09/txt/msg01497.txt.bz2 Juan Ignacio Garzón writes: [snip] > the result was: > a .o file for the main.cpp (803 KB) > a .o file for the .cpp (class definition) ( 810 KB) > the .exe file (1251 KB) > > I'm using gcc 3.2 (mingw32) > I cannot understand why are they so big in size... I > think im doing something bad, but I don't know what... First: use strip -s yourexecutablename.exe and see if that reduces size. Second: MinGW's libstdc++ is statically linked. This means that there is a fixed size overhead for all executables that uses iostreams, for instance. > If I include stdlib.h in any file, it results in a 2 > MB exe. I doubt that by merely #include'ing you obtain a 2 MB exe. Does this program produces a 2 MB exe? #include int main() { return 0; } > I have a lot of programs made with C++ and their > binaries are smaller than mine, and mi program has > less than 100 lines. What's wrong? Those programs compiled with [Visual] C++ uses a dynamically linked C++ Standard Library. My experience shows that, for medium to large projects, MinGW and VC++ 6.x executable size tends to converge. VC++ 7.x uses some clever tricks that can produce considerably smaller executables under some common circumstances. BTW, the correct place for discussing this topic is the MinGW users mailing list, or other MinGW-related forum. This mailing list is for discussing the development *of* GCC, not *with* GCC. -- Oscar