Code::Blocks IDE for Fortran

Code::Blocks is a free, cross platform Integrated Development Environment (IDE) (www.codeblocks.org). This site is for those, who would like to use Code::Blocks IDE for Fortran. Here you can find a customized (more or less) version of IDE oriented towards Fortran language (pre-built binaries for Linux and Windows are available). Also you can find some useful information about how to use it for programming with Fortran.

Note: FortranProject plugin, which makes C::B useful for Fortran, currently is included in an official Code::Blocks distribution for Windows (but not for Linux).

News

(13.02.2018)

A new release v1.5 is out.

I would call this release a bug-fixing/feature-polishing release. I would like to say thanks to the users who pointed to the problems in the IDE.

Besides fixed bugs, this release adds possibility to show a Call-tree and a Called-by-tree. This feature should help developers to understand their code more quickly. To show Call-/Called-by-tree right-click on the procedure name in the editor and select "Show" submenu (see screenshot below).

/images/cb_called_by_tree.png

(09.12.2016)

A new release v1.4 is out. New features in this release:

  • Improved handling of submodules: during compilation the dependancy of files containing submodules from their parent modules is taking into accout.
  • Fortran construct highlighting, e.g. if the cursor is placed between "do", then FP plugin will find corresponding "end do" statement and highlight it (see image below). This feature should help more quicklly understand the logic of the code.
  • FormatFortranIndent plugin was merged into FortranProject plugin. As earlier, you will find this tool in "Fortran->Format indent". There was added some options using which you can adjust indent to your taste. Plase, test this tool. If you feel, you need more options, maybe I could add them. Just write me.
  • Added possibility in editor to fold lines, which contains comments, if comments go through 4 and more lines (see image below). This feature was not yet commited into the official Scintilla text component. If you found errors in the folding of Fortran code, write me. Maybe I could improve it.
/images/cb_con_highlight.gif /images/cb_comment_folding.gif

(18.06.2016)

I have uploaded three short video tutorials on YouTube, which show how to start using C::B for programming in Fortran.

Code::Blocks IDE for Fortran: First steps (Windows) Code::Blocks IDE for Fortran: First steps (Windows)

Code::Blocks IDE for Fortran: First steps (Linux) Code::Blocks IDE for Fortran: First steps (Linux)

Compilation of existing Fortran code with Code::Blocks IDE Compilation of existing Fortran code with Code::Blocks IDE

(27.02.2016)

A new release v1.3 is out. Comparing with an official C::B, CBFortran for Windows includes support for Intel Fortran compiler and FormatFortranIndent plugin and some other smaller changes. The official C::B for Linux doesn't include FortranProject plugin, therefore CBFortran is the only option for Linux users if they what to use C::B in development with Fortran.

New features in this release:

  • A documentation window side-by-side to code-completion list. If your code includes a documentation of some item, it can be showed in this window. FortranProject plugin recognizes the documentation: a) written in Doxygen, b) simple comments, which comes for procedures: above or below procedure declaration, and for variables: after on the same line. Make your code speak! ;-)
  • Tool called Auto Insert, which inserts "end..." statements automatically when you press “enter” after statements which require such “end”. Some preferences for Auto Insert can be adjusted on FP settings dialog (Settings->Editor->FortranProject). Just do your job and you will see the magic! ;-)
  • The parsing of Gfortran multi-line messages was considerably improved.
  • BindTo tool. Actually, this tool took the most of my efforts. BindTo (Fortran->Bind To…) can automatically generate a wrapping for Fortran code which enables call of Fortran from the C language and can generate Cython files which enables call of Fortran from Python language. Resulting toolchain is something like: “Fortran->Bind(C)->Cython->Python”. Actually, the tool doesn’t do anything you can’t do yourself. It just saves your time. To better understand how to use BindTo, I wrote BindTo Users Guide, which hopefully will answer to most of your questions (other questions I expect to see on CBFortran google group). Please consider the current version of BindTo as “beta” or even “alpha”, especially the part for the generation of Cython files. Your opinion, ideas, suggestions, corrections etc. are very welcome!
/images/doc_window.png /images/cb_binto_gen_result.png

(10.07.2014)

Examples how to use MathGL library together with GTK from Fortran were uploaded to MathGL + GTK + Fortran.

More news

Features

  • Editor with Fortran syntax highlighting (fixed and free form).
  • Compilation of Fortran project directly from IDE. FortranProject plugin should care about Fortran file dependencies. Alternatively you can use your supplied makefile.
  • Possibility to jump directly to the code line with an error (currently the support of gfortran, g95, Intel Fortran, Oracle Solaris Studio Fortran and PGI Fortran is implemented).
  • Symbols browser with defined program units (functions, subroutines, modules etc.) in your project.
  • Possibility to jump to code line with subroutine/function definition directly from editor (right click on the name and select "Jump to: 'name'") or from the symbols browser (double click on the name) or using menu 'Search->Jump to declaration'.
  • Program debugging using GNU GDB or IDB (Intel's debugger on Linux).
  • Completion of names when you type or when you press Ctrl+Space (you can change the key combinations in Editor's Settings). The support for subroutine/function names, the names of variables, the components of derived types and the type-bound procedures is implemented.
  • Call-tips with subroutine/function argument list. Appears automatically or when you press Ctrl+Shift+Space.
  • Appearance of tooltips when you hold mouse on variable or name of subroutine.
  • Jump to the definition of procedure or the variable from code line where it is mentioned.
  • Possibility to generate a Makefile (Fortran->Genarate Makefile). This feature should generate a working makefile for the active target in simple cases. Or the generated makefile can be used as a draft in more sophisticated projects.
  • and more

License

Code::Blocks (and FortranProject plugin) is distributed at GPLv3.

Installation

Just extract archive in your favored directory. To launch Code::Blocks run codeblocks.exe (on Win) or codeblocks_run.sh (on Linux). If you have another Code::Blocks distribution on your system you may want to start Code::Blocks as a portable app by executing startup script codeblocks_portable.bat (codeblocks_run_portable.sh). Code::Blocks saves all settings in installation directory if you launch program using codeblocks_portable.bat (codeblocks_run_portable.sh). How to setup compiler's installation directory read on Notes page.

Prerequest

To be able to compile your Fortran files you should have an installed Fortran compiler (gfortran or another one). Windows users first should install MinGW on their system. I would suggest to install MinGW from tdm-gcc.tdragon.net. If you are going to use gfortran, don't forget to mark it during installation. It may be useful to read GFortranBinaries page. You may find useful to look at short tutorial posted to CBFortran Google group: how to setup Fortran with C::B on Windows.

Linux users should have 'gtk2' and 'xterm' installed on their system. Linux versions were tested on several recent distributions.

User manual

You can download the Code::Blocks user manual from www.codeblocks.org/user-manual.

Development

The major part, which makes C::B IDE useful for Fortran, is FortranProject plugin. This plugin has a separate project for development on Sourceforge. There you can download latest source code directly from svn.

Contribution

How to contribute to this project:

  • Spread a word about your experience with Code::Blocks.
  • Write tutorial about how to use C::B together with Fortran. Send it to CBFortran forum.
  • Prepare screencast (video tutorial) and upload it to e.g. Youtube. Drop link to CBFortran forum.
  • Suggest features you would like to be implemented into this IDE.
  • Report bugs to CBFortran forum or write directly to me.
  • Write a new plugin for Code::Blocks useful for Fortran developers.
  • Implement a new feature to FortranProject plugin or improve existing one. Send me a patch file.

About me

My name is Darius Markauskas. I develop for this project on my spare time.

Some info about my main job can be found here.

Have questions, suggestions? Found a bug? Write me to: darmar.lt@gmail.com