Hello,
1. Codeblocks is not a compiler but an IDE (integrated development environment) the compiler is gcc or something else you are using
2. What is the configuration you're building Debug or Release:
2.1. Debug builds produce bigger executables
2.1.1. Because the debug info is embedded in the exe
2.1.2. If there is heavily templated code (boost, stl) the optimizer have not removed the unneeded things brought in by the meta-programming techniques used.
3. If you're using the Release target, you can specify the -s (strip executable, there is config option in the compiler tab), this one removes any removable symbols, so it minimizes the size of the exe.