Re: [Dev-C++] GCC 3.2 (MinGW 2.0) Compiled File Sizes
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Damien <g_...@ho...> - 2003-07-12 17:55:12
|
<html><div style='background-color:'><DIV>
<P>Try adding -s to the commands when calling the compiler. The older version of Dev-C++ did that by default, making the size of your .exe files small.<BR><BR></P></DIV>
<DIV></DIV>----Original Message Follows----
<DIV></DIV>From: "Marc Heiligers" <MA...@E-...>
<DIV></DIV>To: "Dev-Cpp User's List" <DEV...@LI...>
<DIV></DIV>Subject: [Dev-C++] GCC 3.2 (MinGW 2.0) Compiled File Sizes
<DIV></DIV>Date: Sat, 12 Jul 2003 19:03:37 +0200
<DIV></DIV><mailto:dev...@li...?subject=help><mailto:dev...@li...><mailto:dev...@li...?subject=subscribe><mailto:dev...@li...?subject=unsubscribe>
<DIV></DIV>
<DIV></DIV>Hi All,
<DIV></DIV>
<DIV></DIV>I have just downloaded and installed MinGW 2.0 to upgrade my development
<DIV></DIV>environment to the latest (easily available) GCC. The installation process
<DIV></DIV>was surprisingly painless and getting it to work with Dev-Cpp was just as
<DIV></DIV>easy. Good stuff so far. But...
<DIV></DIV>
<DIV></DIV>I just wrote a command line program that does a little string manipulation
<DIV></DIV>and spits out (read as cout << (std::string)) a modified string (using the
<DIV></DIV>command line parameters as input). The complete source is less 100 lines of
<DIV></DIV>code and resides in a single file. I make use of the <IOSTREAM>and <STRING>
<DIV></DIV>headers. I compiled and found it worked perfectly, but the executable was
<DIV></DIV>468KB in size! I was expecting something more along the lines of 10KB. So I
<DIV></DIV>tried the following little program:
<DIV></DIV>
<DIV></DIV>#include <IOSTREAM>
<DIV></DIV>#include <STRING>
<DIV></DIV>
<DIV></DIV>int main(int argc, char *argv[])
<DIV></DIV>{
<DIV></DIV>std::string s = "Hello, World";
<DIV></DIV>std::cout << s;
<DIV></DIV>return 0;
<DIV></DIV>}
<DIV></DIV>
<DIV></DIV>This simple "Hello, World" demo compiles to 442KB (using default compiler
<DIV></DIV>settings, no optimization, no exception handling - and 156KB using the old
<DIV></DIV>Dev-Cpp default compiler). This is a little extreme, don't you think?
<DIV></DIV>
<DIV></DIV>So does anyone know of a way to reduce the file sizes generated by GCC 3.2?
<DIV></DIV>The only thing that springs to mind is that the template class handling of
<DIV></DIV>GCC is not that great. If we try the same demo using C-code (compiled as
<DIV></DIV>C++):
<DIV></DIV>
<DIV></DIV>#include <STDIO.H>
<DIV></DIV>
<DIV></DIV>int main(int argc, char *argv[])
<DIV></DIV>{
<DIV></DIV>char* s = "Hello, World";
<DIV></DIV>printf("%s", s);
<DIV></DIV>return 0;
<DIV></DIV>}
<DIV></DIV>
<DIV></DIV>we get a program that compiles to 21KB (and 9KB using the old Default
<DIV></DIV>Dev-Cpp compiler - even this shows a large increase in size using GCC 3.2)!
<DIV></DIV>
<DIV></DIV>Regards,
<DIV></DIV>Marc.
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>
<DIV></DIV>-------------------------------------------------------
<DIV></DIV>This SF.Net email sponsored by: Parasoft
<DIV></DIV>Error proof Web apps, automate testing & more.
<DIV></DIV>Download & eval WebKing and get a free book.
<DIV></DIV>www.parasoft.com/bulletproofapps1
<DIV></DIV>_______________________________________________
<DIV></DIV>Dev-cpp-users mailing list
<DIV></DIV>Dev...@li...
<DIV></DIV>TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
<DIV></DIV>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
<DIV></DIV></mailto:dev...@li...?subject=unsubscribe></mailto:dev...@li...?subject=subscribe></mailto:dev...@li...></mailto:dev...@li...?subject=help></div><br clear=all><hr>MSN 8 with <a href="http://g.msn.com/8HMFEN/2740??PS=">e-mail virus protection service: </a> 2 months FREE*</html>
|