Exe file sizes

Started by
2 comments, last by GamerSg 20 years, 11 months ago
I realise that the file sizes of the executables are very small as compared to what i get when i compile them. Like lesson 19 is 48kb, but when i compile it, i get a 168kb file. How do i make the file size smaller and does this smaller file size make it any more efficient?
Advertisement
one way of making it smaller is using release instead of debug if you are using ms vc, making it smaller doesnt mean that it will be faster the compiler does optimizations and unroll loops to make it faster thus making the file bigger etc. each function in c is actually ecaluated to a number of asm commands. *usually* its a tradeoff of speed to make it smaller, the reason debug is larger than release is that it contains debug information used by the debugger etc. i *think* you can also control the sixe by removing unused libs not sure if the compiler does this or not but probably does. if you need a small exe then you can use a console application instead of a windows application since it doesnt link with some windows libraries, its usually been smaller for me at least altho size isnt *that* important at least not with that small programs

- Damage Inc.
1) Use Release mode, when compiling&linking/biulding.
2) UPX, an exe packer.

.lick
you can find UPX at http://upx.sourceforge.net/

I''ve used it on several projects and it works great.. the on;y problem I''ve found with it is if you store file types icons with the main exe and associate them with any files you save (custom extensions) then the extra icons get compresses and thus can''t be accessed by windows. (ie your program save a file .xxx and you want to associate an icon image with .xxx (which is stored in the main exe)

This topic is closed to new replies.

Advertisement