Run with /usr/bin/emacs -Q -l init.el bug.org One should be able to click on the following link - elisp:org-babel-tangle to tangle (export) the code blocks in this org file. Then one should be able to execute the code block - [[code_block_to_execute]] by using C-c C-c in code block. However, it does not work because the tangle stage wraps the fortran module in program main end program main which prevents the code from compiling. #+BEGIN_SRC fortran :tangle circle.f90 MODULE Circle implicit None public :: area contains function area(r) implicit none real, intent(in) :: r real :: area area = 3.14159 * r**2 return end function area END MODULE Circle #+END_SRC #+BEGIN_SRC fortran :tangle main.f90 program main use circle, only: area implicit none integer :: i REAL, DIMENSION(5) :: R R = (/1.0, 2.0, 3.0, 4.0, 5.0 /) print *, "#+tblname: circle-area" do i = 1, 5 print *, "|", R(i), "|", area(R(i)), "|" end do end program main #+END_SRC #+BEGIN_SRC makefile :tangle makefile-main circle: @gfortran -c circle.f90 main: circle @gfortran -c main.f90 @gfortran circle.o main.o -o main clean: @rm -f *.o main #+END_SRC <> #+BEGIN_SRC sh :results raw replace make -f makefile-main clean main ./main #+END_SRC #+RESULTS: #+tblname: circle-area | 1.00000000 | 3.14159012 | | 2.00000000 | 12.5663605 | | 3.00000000 | 28.2743111 | | 4.00000000 | 50.2654419 | | 5.00000000 | 78.5397491 |