Author Topic: compiled files: size  (Read 6219 times)

Offline phlox81

  • Multiple posting newcomer
  • *
  • Posts: 53
    • phlox81.de
compiled files: size
« on: June 13, 2005, 09:02:35 pm »
I downloaded Code::Blocks a few days ago, and gotta say, good work guys :) :D

I installed the C::B Version which also brings a mingw compiler along, since
i only have an old MSVC 6...

So, now i startet playing around with some files, and also installed boost.
I was playing a little with boost::filesystem, but than wondered why my
executable was 2 MB big. So, i used the wrong library (debug).
With the normal boost::filesystem library the excutable is just 570 k,
which still is a bit big for a small programm, which only purpose it is
to test some code & compiling.
Then i created a Hello World Project, to see what a 'normal' Hello World
would compile to. Still 470 K.
I started then my old MSVC and copyied the project to it.
Result: Debug Version : 510 Kb, Release: 96Kb.

So, my question is, how can i make the Mingw make a smaller excutable
than now (if its gonna be better than 96 is not so important *g*), but smaller
than 470 would be quite good.
Can i do this by configuring the compiler options in C::B, or how could I achive that ?

Devil

Offline phlox81

  • Multiple posting newcomer
  • *
  • Posts: 53
    • phlox81.de
compiled files: size
« Reply #1 on: June 13, 2005, 09:23:29 pm »
Ok, i found now the Linker Options tab in Compiler Options, and added -s there,
brings in total a filesize of 263, which is for a hello world still a bit big, is less possible ?

Offline polygon7

  • Multiple posting newcomer
  • *
  • Posts: 104
    • Home site
compiled files: size
« Reply #2 on: June 13, 2005, 09:26:28 pm »
Hi,
try to use "-s" compiler (or linker - i dont remember - i use msvc) option,
or "Strip" utility (strip --strip-all). You could merge sections and realign exe, too. Article about reducing exe size: http://www.catch22.net/tuts/minexe.asp :)
best regards,
p7
 Free open source UML modeling tool: ArgoUML

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
compiled files: size
« Reply #3 on: June 13, 2005, 10:13:13 pm »
You might want to take a look at this thread.

Yiannis.
Be patient!
This bug will be fixed soon...

Offline phlox81

  • Multiple posting newcomer
  • *
  • Posts: 53
    • phlox81.de
compiled files: size
« Reply #4 on: June 13, 2005, 10:58:38 pm »
Quote from: mandrav
You might want to take a look at this thread.


how could i add a call to strip each time a exe file is getting compiled ?

Devil

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
compiled files: size
« Reply #5 on: June 13, 2005, 11:48:43 pm »
post-compilation steps, "strip myfile.exe" in your project options. Oh you might like also using UPX, an executable compressor. Also, take in mind that using the stream libraries adds a lot of size to your executable. Using basic i/o (i.e. printf) reduces it a lot.