You are right for codeblocks itself. And, it is his problem apparently.
But when you build an executable with mingw 8.1, and you want to execute it outside of C::B, you need to have access to several other dll like those added in C::B distribution (like libstdc*, libgcc*, ...), but not only. It's why it's preferable to have (also) those dlls in your path.
I met this error several times, but on my own programs, and it's not easy to understand what is missing, even with a tool like DependenciesGUI.
gd_on