VS2003 exe file size won't go under 1MB

Started by
9 comments, last by zedzeek 17 years, 4 months ago
When I build my win32 project (release) exe file is bigger then 1MB even if I comment out all the code in it. I use to build it to 300k exe size, but now I cant build it and I forgot what I did to make it smaller. Problaly some linking option, but I don't know what. And how do you build application in VS2003 so that it dont ask for Framework 1.1 installed later on other machines? Thanks, Petar
Advertisement
Looks like you're building managed applications (hence the need for the framework). To build unmanaged, there should be a '/clr' option for the compiler which you need to remove. You probably need to alter the linker as well. Check the documentation for the command line arguments for the compiler/linker.

Skizz
No sory that is a separate question, application that is > 1M is not managed for sure.
Are you statically linking the C/C++ runtime? You can change /MT to /MD in Project->Properties->Code Generation to reduce the exe size but then the exe can't run on a machine without those DLLs present so you either need to ship them yourself or expect a target machine to have installed them seperatley.
Quote:Original post by Petar Titelski
No sory that is a separate question, application that is > 1M is not managed for sure.

Then, uh, how come it asks for the .NET framework? [wink]
Well I believe that's the problem ;)
And you might want to compile for release and get rid of any unwanted debug info. That's not causing the huge increase in size though (hopefully).
Quote:Original post by Spoonbender
Quote:Original post by Petar Titelski
No sory that is a separate question, application that is > 1M is not managed for sure.

Then, uh, how come it asks for the .NET framework? [wink]


application > 1M is not asking for .NET framework. That was a question for another project. Two separate projects.
Quote:Original post by EasilyConfused
Are you statically linking the C/C++ runtime? You can change /MT to /MD in Project->Properties->Code Generation to reduce the exe size but then the exe can't run on a machine without those DLLs present so you either need to ship them yourself or expect a target machine to have installed them seperatley.


Its set to ST.
Quote:Original post by l3mon
Well I believe that's the problem ;)
And you might want to compile for release and get rid of any unwanted debug info. That's not causing the huge increase in size though (hopefully).


It's build for release. Debug version is about 5MB.
You are probably linking statically with the run time libraries - that could explain the size of the file. Another thing that could explain it is usage of template classes (that can be expanded and inlined). You may also have created static, initialized arrays (if you add a global array to the code, and if this array is initialized then the exe must contain the initialization data; same goes for litteral strings).

If you are really concerned about the exe size, you can also use compressing softwares like (for example) upx to reduce the exe size.

But in the end, it doesn't really matter. 1 MB is still pretty small by today's standard - where you can buy 320 GB hard drives for less than 100$.

Regards,

This topic is closed to new replies.

Advertisement