1. Turn on Full Compiler logging.
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F2. Find an website that supports DirectX 9 compiling or your compiler.
3. Find the right directions to compile DirectX 9 or DirectX 9 Apps using the Compiler you are using likely MinGW GCC.
4. Ask your programing questions on the site you find that supports DirectX 9 or DirectX 9 Apps compiling or your compiler.
Code::Blocks questions like where is the place to add this compiler/linker option inside Code::Blocks are the type of questions that are valid for this site.
Note: You could change compilers to match your directions.
Edit: Some of your warnings match what would happen if you use Microsoft Visual C/C++ directions/options to build using MinGW GCC.
Tim S