compile a code

Dec 30, 2011 at 9:05am
hi
i have a code and a compiled example of that
the file size is 6kb and it doesn't need c++ runtime to run
but when i compile that code myself, size going to 30 kb and it need c++ runtime
what's my wrong?
sorry for my eng
Last edited on Dec 30, 2011 at 9:06am
Dec 30, 2011 at 11:12am
closed account (zb0S216C)
The compiler is free to add additional information prior to or during compilation. Inline functions and macros, for example, contribute to the final size of the executable. Headers, templates, exception handling, RTTI and debugging information also contribute to the final size of a program. Compilers can optimize your code to reduce the overall size, as well as other optimization's.

If you're using MinGW's compiler, investigate UPX[1].

References:
[1]http://upx.sourceforge.net/


Wazzak
Last edited on Dec 30, 2011 at 11:13am
Dec 30, 2011 at 2:30pm
also, use:
--static-libstdc++
when compiling

It won't say c++ runtime needed then.
Last edited on Dec 30, 2011 at 2:34pm
Topic archived. No new replies allowed.