Codeblocks is not a compiler, but an ide.
If you compile something, codeblocks simply assembles commandlines and executes them.
So the question is: Is it possible to get your compiler (Mingw, Visual C++, or what you are using) to compile the os?
Edit: Have a look at the build.bat file in the sources. It should give you an idea how to compile the kernel correctly.
Regards
raph