I figured out why I was having problems with the compiler. minGW was installed in the same program file as C++ so you have to change the default file location go to
"Settings -> Compiler and debugger -> [your compiler] -> Toolchain executables"
then
under compiler instillation directory change the location to where you installed C++ the old one should look like
this ----> C:\minGW
the new one should look like
this -----> C:\Program Files\CodeBlocks\MinGW
couldn't find an answer to this problem so I posted.