Your message is not enough explicit, but if the missing dll(s) is in the bin subdirectory of your compiler (probably a MinGW), add simply this full bin path to your PATH variable (your system one or your user one : easier if you are not admin).
For your information, Code::Blocks adds this path for his own usage, it's why your code works inside code::blocks, but the Windows general path is not modified: it's why dll is missing because Windows does not know where to find it (or them). More, if you want to distribute your code, it may be neccessary to add those dll to your distribution in the same directory where your exe is. You can also copy those dll in your exe directory for yourself, but I prefer the first solution : modifying the PATH variable.
NOTE : this question has been asked many many times on this forum. Use the search button with "miising dll" (for example) as the search key !