settings->compiler->在compiler flags中勾选static linking

参考:

codeblocks+mingw怎么实现静态编译 – 百度文库 (baidu.com)

gcc – How to add compiler flags on codeblocks – STACKOOM

怎样静态编译C++程序-百度经验 (baidu.com)