does anybody know how to reduce the size of an exe file
Thanks.
does anybody know how to reduce the size of an exe file
Thanks.
If you're asking literally, how to reduce the size of an exe file, and I presume you still want it to work, then the answer is no, I don't. That's like asking to change the size of the steer, when you hold it's meat in a lump of hamburger.
If you mean change the program that created the exe file, so it's making a smaller exe file, then yes, you have several options.
First and foremost would be to reduce the number of include files. The changes needed to do this, while keeping the program working, may be small or large. Great care must be taken, and thorough testing afterward is essential.
How large is this exe file, anyway? What size do you want it to be? Is it coded with an efficient algorithm?
- you can strip the symbol stuff out gcc -s main.c
- compile for size gcc -Os main.c
You could use an executable packer like UPX. UPX is really neat. It compresses your executable. When you go to run your program, it decompresses it in memory. It's incredibly fast. You probably wouldn't notice the delay in startup time at all. UPX is available here: http://upx.sourceforge.net/
Reducing the number of include files won't decrease the size of the executable. It might reduce compile time, but the size of the resulting executable is completely independent of which header file were included.First and foremost would be to reduce the number of include files. The changes needed to do this, while keeping the program working, may be small or large. Great care must be taken, and thorough testing afterward is essential.
You could reduce the number of libraries used, but generally if you're using a library it's important.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
> First and foremost would be to reduce the number of include files.
This seldom has anything to do with the size of the executable. Header files contain declarations only, they do not take up actual code space.
You might see the size grow because of additional symbol table information, but that would be removed if you follow robwhit's comments on 'strip' (which is also available as a separate command).
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.