I tried the first method suggested (restoring to defaults) and it didn't work. I think this was because there was no gnu gcc exe file. Then I tried the second method, downloading the compiler from online, and Code::Blocks did recognize the compiler, but when I tested the compiler on the default Hello World program, I got this error message:
-------------- Build: Debug in Starter project (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -pedantic -Wextra -Wall -c "C:\Users\ALEX\Desktop\CodeBlocks\share\CodeBlocks\images\Projects\Starter project\main.cpp" -o obj\Debug\main.o
Execution of 'mingw32-g++.exe -Wall -fexceptions -g -pedantic -Wextra -Wall -c "C:\Users\ALEX\Desktop\CodeBlocks\share\CodeBlocks\images\Projects\Starter project\main.cpp" -o obj\Debug\main.o' in 'C:\Users\ALEX\Desktop\CodeBlocks\share\CodeBlocks\images\Projects\Starter project' failed.
So, what now?