This repository contains the code examples of How to reduce binary size in C++.
For each example, you'll get the command to compile it with Clang which should work with GCC as well, unless it's indicated. In general, it's worth trying to compile with different optimization levels, at least with -O0
, -Os
and -O3
and compare the sizes of the resulting binaries.
You'll find more detailed instructions in the right subdirectories if applicable.