why are my GCC applications so huge on windows?

closed account (2EwbqMoL)
Write your question here.
I wrote some of what I thought was pretty elegant, concise, and efficient code...
but GCC still outputs this file at 1.5 megabytes. I just think its rather large for a console program that simply finds the sum of all multiples of two separate numbers both individually and then added together (I was solving for project euler #1, but instead of simply doing the math with C++, I wrote a program that finds the answer for any set of real numbers below any maximum amount.

all the code is is some for loops, one do while loop, a couple if statements and some maths, everything works well, there are no code problems in it... its just huge coming out of TDM-GCC.

is there any options I can feed the compiler to try and optimize for filesize better, or is the mingw runtime just that big?
Hi,

Try to compile to release version as opposed to the debug version.

Hopefully you can set this option in your IDE.

Under g++ the command line option is -O3.

Hope all goes well

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options
> options I can feed the compiler to try and optimize for filesize better

g++ -std=c++14 -O3 -Wall -Wextra -pedantic-errors -shared-libgcc -shared-libstdc++ my_program.cpp

These are some of TDM-GCC's "quirks": just a few things you need to know about TDM-GCC before diving in.
...
TDM-GCC doesn't link your programs with the libgcc or libstdc++ runtime DLLs by default.
...
TDM-GCC still includes DLL versions of the libgcc and libstdc++ runtimes, which you can enable for your program with "-shared-libgcc" and "-shared-libstdc++" if desired.
http://tdm-gcc.tdragon.net/quirks
Topic archived. No new replies allowed.