I was interested in setting up graphics for Code Blocks when I ran into a this error: (took me 2 hrs to solve it)
I guess you need to have a bit of luck with this. In my case i just changed the order of contents in Settings menu->Compiler and Debugger->Global compiler settings->Linker settings->Other Linker Options: The working sequence is: -lmingw32 -lSDL -lSDLmain