UCL WIKI

UCL Logo
Child pages
  • Code::Blocks Fortran
Skip to end of metadata
Go to start of metadata

Step-by-step guide

Install and run

  1. Copy the folders CodeBlocks_Fortran_v1.2_Linux64 and .codeblocks from /nfs/workspaces/ucapsyu/codeblocks into your home folder:

    $ cp -r /nfs/workspaces/ucapsyu/codeblocks/CodeBlocks_Fortran_v1.2_Linux64 $HOME
    $ cp -r /nfs/workspaces/ucapsyu/codeblocks/.codeblocks $HOME
  2. Start Code::Blocks by running $HOME/CodeBlocks_Fortran_v1.2_Linux64/codeblocks_run.sh &
  3. Running your first program

    Select from the menu “File”→“New”→“Project” and click on “Fortran Application”


    Choose the name of your project (e.g. “my_first_project”) and a folder, click on “Next”


    Choose the compiler (e.g. “Intel Fortran Compiler”), click on “Finish”


    Your workspace will look like


    Compile program by clicking on (compile) button, click (execute) button to run the program.

    The compilation/execution logs are printed in   panels below.

    To set up the I/O redirection, select from the menu "Project"→"Set program's arguments..." and specify the name of the input and output files, e.g. <$HOME/my_first_project/input_file >$HOME/my_first_project/output_file, in "Program arguments" box.


    The debugger tools   will help you to find (run-time) errors in the program by making it stop at various locations of the source code.  For example, "Run to cursor" enables to stop execution of the program at a selected line of the source code (at current cursor position), while "Debug/Continue" will resume program execution until the next breakpoint.
    The breakpoints can be toggled/removed in the source code by "F5".
    The following figure shows a program suspended at one of the breakpoints

    To check/amend the run-time values of the variables at a breakpoint, simply right-click on the variable, select "Watch <name of the variable>", a dialogue box "Watches (new)" will pop up displaying the value and kind of the variable as well as dimensions in case of array or character variables.

 

Don't close this terminal!