I have a rather simple C++ project, which uses boost::regex library. The output I\'m getting is 3.5Mb in size. As I understand I\'m statically linking all boost .CPP files,
The -O3 flag will not optimize your code for size, but rather for execution speed. So maybe e.g. some loop-unroling will cause a bigger file. Try to compile with some other optimization flag. The -Os flag will optimize for a small executable.