You need to configure your Fortran project properly. The best way to start a new Fortran project is to use the "Fortran application" template:
File > New > Project... > Projects > Fortran application > Go
This way all necessary settings needed for a Fortran project are applied.
But you can also manually set these settings.
1) First set the compiler:
File > Settings... > Compiler... > Global compiler settings > Selected compiler: GNU Fortran Compiler
Then the toolchain:
File > Settings... > Compiler... > Global compiler settings > Toolchain executables > Program files
with the settings:
C compiler: mingw32-gfortran.exe
C++ compiler: mingw32-gfortran.exe
Linker for dynamic libs: mingw32-gfortran.exe
Linker for static libs: ar.exe
Debugger: GDB/CDB debugger : default
Resource compiler: windres.exe
Make program: mingw32.make.exe
2) Next you can configure the debugger:
Settings > Debugger... > GDB/CDB debugger > Default > Executable path > C:\Program Files (x86)\CodeBlocks\MinGW\bin\gdb32.exe
and select GDB as debugger.
3) Next you can specify that all libraries should be statically linked to the exe-file, so the application contains just one file:
File > Project > Build options... > Select application name > Linker settings > Other linker options > -static
4) Finally, you need to update the file "libgfortran-3.dll" as described in
this post in order to work with files.