Reducing binary size in C++ projects | Cypress Semiconductor
Reducing binary size in C++ projects
If you want to reduce binary size in C++ projects, one of the most effective ways is to not use exceptions. And if you're not using them, you can tell the compiler to remove a lot of the backend code by specifing -fno-exceptions while compiling. Refer the GCC manual for details.
Unfortunately, some exception code is still retained as the new operator will throw bad_alloc if it fails to allocate storage. You can override new (and new) and delete (and also delete) to just do malloc and free. This removes the exception handling code and results in a much smaller binary.
See this link for details on this and a few other tricks.
Post any other ideas you guys have here to reduce binary size.