why my C++ output executable is so big?

后端 未结 6 727
梦毁少年i
梦毁少年i 2020-12-14 20:31

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,

6条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 20:36

    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.

提交回复
热议问题