Thread: [Dev-C++] Executable size is huge
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Kevin S. <web...@ba...> - 2003-12-29 12:59:52
|
Hi, using a simple Hello World program and the appropriate compiler flags (-O3) and without any debug info the executable is about 440KB in size. The compiler doesn't seem to be doing any dead code removal. I remember I had this problem a long time ago when I used cygwin but I don't remember my solution. -- Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ |
From: <or...@vp...> - 2003-12-29 13:27:16
|
Kevin Sopp wrote: > using a simple Hello World program and the appropriate compiler flags > (-O3) and without any debug info the executable is about 440KB in size. > The compiler doesn't seem to be doing any dead code removal. I remember > I had this problem a long time ago when I used cygwin but I don't > remember my solution. This is not a problem, and there is no real "solution" to it. One alternate "solution" might be to use simple C code for a Hello World program. That will get you a 20 KB exe :) However, if you wish to reduce the size of your exe, use UPX. http://upx.sf.net The size growth for C++ is because stdc++ is linked statically into the exe, however when using simple C code, the exe is linked dynamically to Windows DLLs (like msvcrt.dll, etc.) -- Greetings, Balázs |
From: Jack C. <jac...@ya...> - 2003-12-30 00:23:40
|
So then C++ compiled files will be 10x bigger than C compiled ones? Man I made a program that draws 3D objects with OpenGL and graphical interface with GTK. It's C code and the exe is only 34KB. I'm wondering what the file size will be if I do it in C++... Does anyone think the developers of Dev-C++ will change it? It's very scary. Jack --- OROSZI_Balázs <or...@vp...> wrote: > Kevin Sopp wrote: > > using a simple Hello World program and the appropriate compiler > flags > > (-O3) and without any debug info the executable is about 440KB in > size. > > The compiler doesn't seem to be doing any dead code removal. I > remember > > I had this problem a long time ago when I used cygwin but I don't > > remember my solution. > > This is not a problem, and there is no real "solution" to it. > > One alternate "solution" might be to use simple C code for a Hello > World > program. That will get you a 20 KB exe :) > > However, if you wish to reduce the size of your exe, use UPX. > http://upx.sf.net > > The size growth for C++ is because stdc++ is linked statically into > the > exe, however when using simple C code, the exe is linked dynamically > to > Windows DLLs (like msvcrt.dll, etc.) > > -- > Greetings, > Balázs > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for > IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys > admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ______________________________________________________________________ Post your free ad now! http://personals.yahoo.ca |
From: Per W. <pw...@ia...> - 2003-12-30 01:19:52
|
No, the developers of Dev-C++ will not change anything since they are developing an IDE - an integrated environment - and not a compiler. No, the developers of MinGW will not change anything either, since they are "just" creating a port of the gcc compiler for use in the Win32 environment. Maybe, but with not too large probability, the GNU project might look into the implementation of the c++ RTL, and see if they can split in into smaller modules to allow the linker to better strip away unused code from the RTL. The next thing to think about is that a binary linked with a static library will get A LOT bigger than a binary linked with dynamic libraries. /Per W On Mon, 29 Dec 2003, Jack Chen wrote: > So then C++ compiled files will be 10x bigger than C compiled ones? Man > I made a program that draws 3D objects with OpenGL and graphical > interface with GTK. It's C code and the exe is only 34KB. I'm wondering > what the file size will be if I do it in C++... > > Does anyone think the developers of Dev-C++ will change it? It's very > scary. > > Jack > > --- OROSZI_Bal=E1zs <or...@vp...> wrote: > Kevin Sopp wrote: > > > using a simple Hello World program and the appropriate compiler > > flags > > > (-O3) and without any debug info the executable is about 440KB in > > size. > > > The compiler doesn't seem to be doing any dead code removal. I > > remember > > > I had this problem a long time ago when I used cygwin but I don't > > > remember my solution. > > > > This is not a problem, and there is no real "solution" to it. > > > > One alternate "solution" might be to use simple C code for a Hello > > World > > program. That will get you a 20 KB exe :) > > > > However, if you wish to reduce the size of your exe, use UPX. > > http://upx.sf.net > > > > The size growth for C++ is because stdc++ is linked statically into > > the > > exe, however when using simple C code, the exe is linked dynamically > > to > > Windows DLLs (like msvcrt.dll, etc.) > > > > -- > > Greetings, > > Bal=E1zs > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: IBM Linux Tutorials. > > Become an expert in LINUX or just sharpen your skills. Sign up for > > IBM's > > Free Linux Tutorials. Learn everything from the bash shell to sys > > admin. > > Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3Dclick > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > ______________________________________________________________________ > Post your free ad now! http://personals.yahoo.ca > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=3D1278&alloc_id=3D3371&op=3Dclick > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Michael C U. <mu...@cb...> - 2003-12-30 02:27:44
|
On Mon, 29 Dec 2003, Jack Chen wrote: > Does anyone think the developers of Dev-C++ will change it? It's very > scary. This isn't really unique to Mingw32. In fact, you will hear a lot of C fans argue that one of the reasons they don't like C++ is because the Standard C++ library is so bloated, and does produce such large binaries. Now the GCC compiler is not known for being the most efficient compiler in the world, or for doing a really good job of optimizing code, and the problem is exagerated in GCC over some other compilers. But the problem does exist in other compilers as well. But I think what you need to ask is does it matter? GCC is free, and it does optimize well enough for all but the most demanding tasks. The C++ Standard Library might be bloated, but is a 400K executable really a problem when the average computer today has 256Mb of RAM? |
From: Tim S. <ti...@we...> - 2003-12-29 13:27:25
|
Hi Kevin, you could try strip, for example 'strip -s filename.exe'. If you think your executeable is still too big, you could give upx (upx.sf.net) a try. so long Tim |
From: Per W. <pw...@ia...> - 2003-12-29 13:36:40
|
It is not the compiler. It is the linker in combination with the design of the c++ library. If you strip the binary, it will be a bit smaller, but you will still get a bit of extra from the RTL. /Per W On Mon, 29 Dec 2003, Kevin Sopp wrote: > Hi, > using a simple Hello World program and the appropriate compiler flags > (-O3) and without any debug info the executable is about 440KB in size. > The compiler doesn't seem to be doing any dead code removal. I remember I > had this problem a long time ago when I used cygwin but I don't remember > my solution. > > -- > Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/ > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |