I assume your using code blocks in windows.
The reason for the difference in the console is because code blocks uses Msys which is a minimal implantation of a POSIX (*nix) shell environment.
Msys treats paths in windows like *nix paths C:\folder\file.ext can be access via /c/folder/file.
MSYS works together with MinGW to provide a *nix like environment and build chain, including GCC, make, auto-conf and a few others, you can also build most open source libraries fairly easily in the same way you would on a *nix system: "./configure" "make" "make install".
There are a few things you should check that your doing right when compiling SDL with MinGW.
g++ seems to work better than gcc in my experience.
You need to set up the options going to g++:
-g -O2
include Dir:
-I/mingw/include/SDL
Defines, you can also replace the -D with #define and put at the top of your source:
-D_GNU_SOURCE=1 -Dmain=SDL_main -DHAVE_OPENGL
Lib folder
-L/mingw/lib
Libraries:
-lmingw32 -lSDLmain -lSDL -mwindows
These setting might not work for you but there pretty close, so check where the SDL.h and lib file is and adjust if necessary. Though those are probably set up right if it is compiling.