How to install Code::Blocks with a Fortran compiler
To install a Fortran compiler (gFortran) to be used within the Code::Blocks IDE editor:
- Go to http://www.codeblocks.org/downloads
- Click on “Download the binary release”
- Click on “Windows 2000/XP/Vista/7//8”
- Click on “codeblocks-13.12mingw-setup.exe” to download from SourceForge.net
- Once downloaded (~100MB), install Code::Blocks IDE
- Full installation
- Destination “Program Files\CodeBlocks”
- “Do you want to run CodeBlocks now?” NO
- Start Code::Blocks from the shortcut on Desktop (or find in programs)
- When the IDE opens, go to “Settings” > “Compiler…”
- From the “Selected Compiler” option, select the “GNU Fortran Compiler” from the list
- From below, select “Toolchain executables” TAB
- Now check that the “Compilers installation directory” is set to the MinGW folder within Codeblocks
[bash]c:\Program Files\CodeBlocks\MinGW[/bash] - Click Ok to close the options dialog, close Code::Blocks and re-open
- You should now be able to create and compile Fortran sources
Create a simple program (try .f90 or .f95 or .f) and compile:
[cpp]program test
do i=1,5
print*, ‘Hello Fortran’
end do
end program[/cpp]
Comments