And if you use gcc remember to ever add -static to the command you use for building.
Personally I also like -mtune=generic that makes your exe compatible with older CPUs and -m32 to make it 32bit (for retro-compatibility with old WinXP/7).
If curious, the following are the main gcc switches I use for building quickbms:
Quote:
-s -O2 -Wl,--enable-stdcall-fixup -Wl,--large-address-aware -mtune=generic -fno-unit-at-a-time -m32 -Wl,--stack,4194304 -fstack-protector-all -Wstack-protector -fwrapv --param ssp-buffer-size=1 -fno-strict-overflow -Wformat-security -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-auto-image-base -Wl,--enable-auto-import -fno-omit-frame-pointer -static -Wall
They are used for smaller exe size, optimized instructions, stack security, larger stack, dynamic locations and so on.
Older versions of gcc create smaller executables.