Change "Settings -> Compiler and debugger... -> Global compiler settings -> [the compiler you use] -> Other settings(rightmost tab)" "Compiler logging" to "Full commandline" and post the content of the build log.
Make sure the global compiler settings (see above) for search and link dir's are empty (unless you know exactly what you do), and make sure the toolchain is setup correctly and pointing to the correct directories/executables. The master path ("Compiler's installation directory") is prepended to the system path, so two versions of gcc can mess up C::B and it is possible that the commandline works, but not the version used in toolchain (if it is not set up correctly).