The errors you're getting indicate that the linker is having trouble locating __w32_sharedptr
which is probably a dependency libstdc++ needs to work.
Normally the standard library and any dependencies it needs are linked in automatically when you build your project. However, as trojanfoe's comment indicates this is only true if you're compiling with g++. If you're building C++ code with gcc, the C++ standard library won't get included automatically since the gcc driver thinks it's compiling C code.
To verify what's actually happening in your codeblocks setup go to Settings->Compiler and Debugger->Global compiler settings(on the left)->under Toolchain executables tab. You should see something similar to this:
If your setup looks right but still refuses to build properly, enable full compiler logging and see what commands are actually being invoked by the IDE. You can find this under Global compiler settings->Other settings tab-> Compiler Log = Full command line. Note you might have to scroll a bit to the right to find the tab.
With full logging enabled, rebuild your project again and update your question with the commands used.
This is approximately what you should see in the log window when you rebuilt with the above options turned on:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…