I was getting this error (not sure if this was cause I upgraded to Windows 8 or was a different problem)
"sample1 - Debug" uses an invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]. Probably the toolchain path within the compiler options is not setup correctly?!
I then solved this by going into the settings tab,
then into the Compiler and debugger tab,
then selected the <toolchain executable> tab,
and then changed to the compiler's installation directory to where i had installed code::blocks MinGW
Hope this helps