Sign in to follow this  

Reducing file size of a compile in Dev-C++

This topic is 4746 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I think I might be missing something here. My complete program contains 208 lines and only links to iostream, winsock, and stdlib but yet my final compile size come to 455kbs. Is there a way to reduce this size? I think thats a little big for such a small program.

Share this post


Link to post
Share on other sites
iostream takes up a lot of space, but to make the exe really small either (in the Project Options) write -s in the Parameters-Linker or check the
"Strip executable" in the Compiler->Linker, it will do the same. Also, if you want to include windows.h at some level, just include the files you want seperatly and #define WIN32_LEAN_AND_MEAN. But for reasons, you cannot get beneath 5 KB for programs, and 4.5 KB for DLL's.

EDIT: And of course, disable debugging (Compiler->Linker) and profiling (Compiler->Code profiling)...

Share this post


Link to post
Share on other sites
Even if you have the -s command or check Strip Executable, it is still going to be big, about 206kbs, well at least for me it still is and my programs are the little exercise ones from C++ Primer Plus.

Share this post


Link to post
Share on other sites
Don't worry about it. Executable size isn't relative to the length of the program; for example, you could have a 2000 line program compile to 1 mb and a 25 line program compile to 500 mb.

Share this post


Link to post
Share on other sites
-s removes all debug info anyway.

-g enables debug. If you don't put it, it only put symbols in or something.

You aren't going to make the statically linked libstdc++ any smaller by removing anything else however.

The alternatives are:
- Live with it
- Don't use libstdc++ at all (which is of course painful, you won't get iostream or new) . This essentially means use C.
- Use less libstdc++ - cut out iostream (which might just about be livable-with if you're perverse enough)
- Use a dynamically linked libstdc++, which may not generally be desirable on win32. I don't know.

There are so many posts about exe size, and it's sooo unimportant. Really.

Mark

Share this post


Link to post
Share on other sites

This topic is 4746 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this