I use a very similar computer for development (though I have a P5Q Pro and store compiler, headers, and libraries on solid state) and Code::Blocks certainly works very well with that configuration.
21 seconds is an awful lot for a small console project. To give a comparative number, when doing a clean rebuild of the Code::Blocks sources and forcing an abort after 21 seconds, my computer manages to compile and link the targets tinyXML, AutoRevision, ConsoleRunner, Squirrel, Squirrel stdlib, SqPlus, scintilla, wxFlatNotebook, and it finishes precompiling the entire SDK headers (it's caught by the abort while compiling the first 4-6 files of the SDK).
You should ensure that your libraries are in a "good" location, i.e. contiguous on disk, because the linker has to do a lot of reads. The same goes for the system headers. If you can afford a second drive, put compiler, headers, and libraries on one, sources and objects on another. If you can afford a solid state disk, buy one (for headers, libraries, compiler). If you can afford them, buy two and RAID them.
Check that parallel builds are enabled in the compiler options (rightmost tab) to take advantage of the 4 cores. The "correct" number of concurrent builds varies from system to system, a good start is cores + 1.
Make sure there is no malware scanning your disks all the time, turn off the Windows indexing and system restore services, and uninstall every possibly present shit like Kaspersky live protection or everything that starts with "Norton".
It is not sufficient to exclude your development files or even the whole partition from scans, because forementioned shit software still serializes every disk and network access through one process. It thus doesn't matter how many cores and disk spindles you have, or how fast they are.