Menu

exe file volume

kaasiro
2005-04-14
2012-09-26
  • kaasiro

    kaasiro - 2005-04-14

    Hi, I create a new minimalist C++ console application. The exe file is 416 KB, I think a little big, the source file is only 1 KB. I add no additional library or debug informations in the project. How can I reduce the volume of the exe file? I use Dev-C++4.9.9.0, OS is XP SP2.

    Here is the source:

    include <iostream>

    include <stdlib.h>

    using namespace std;

    int main(int argc, char *argv[])
    {

    system("PAUSE");
    return 0;
    }

     
    • Wayne Keen

      Wayne Keen - 2005-04-14

      You can add the -s option (which strips the symbol table) - which will bring it down to about 200K (and will make debugging a pain, take it our if you shoose to debug)

      The size you are observing is the result of the use of streams, and some issues with mingw and how some libraries have to be linked due to licencing issues. A couple of observations

      (1) It is a one time, overhead charge, so bigger programs do not become huge - I work with code every day with 10's of thousands of lines of code, and its only like 600K in size

      (2) There is no impact on performance, so unless you are doing embedded applications, or have to spend your life on floppies, don't worry about. I don't (in fact, I never strip my executables)

      There have been a lot of discussions of this over the years on the Bloodshed forum. Sometimes heated, fueled by people who can barely write hello world but insist that this issue is critical and will result in a significant increase in death, starvation and poverty and dandruff.

      Any way, there it is

      Wayne

       
    • tim

      tim - 2005-11-06

      if you don't need teh extras in c++, try c instead.
      as wayne says, streams has a large overhead, certainly compared with stdio. Your example in c without streams can be stripped down to less than 10k

       

Log in to post a comment.