title: Linking LAPACK from Intel MKL with gfortran
body: <p>I have a problem to link lapack to fortran example program. Here is the program example.f95</p>
  
  <pre><code>Program LinearEquations
  ! solving the matrix equation A*x=b using LAPACK
  Implicit none
  
  ! declarations
  double precision :: A(3,3), b(3)
  integer :: i, pivot(3), ok
  
  ! matrix A
  A(1,:)=(/3, 1, 3/)
  A(2,:)=(/1, 5, 9/)
  A(3,:)=(/2, 6, 5/)
  
  ! vector b
  b(:)=(/-1, 3, -3/)
  !b(:)=(/2, 2, 9/)
  
  ! find the solution using the LAPACK routine DGESV
  call DGESV(3, 1, A, 3, pivot, b, 3, ok)
  
  ! print the solution x
  do i=1, 3
    write(*,9) i, b(i)
  end do  
  
  9  format('x[', i1, ']= ', f5.2)  
  end program LinearEquations
  </code></pre>
  
  <p>I have installed libraries here</p>
  
  <p><code>/opt/intel/compilers_and_libraries_2017.4.196/linux/mkl/lib/intel64_lin/libmkl_lapack95_ilp64.a
  </code></p>
  
  <p>I am using gfortran to compile program:</p>
  
  <p><code>
  gfortran -o example example.f95 -L/opt/intel/compilers_and_libraries_2017.4.196/linux/mkl/lib/intel64_lin/libmkl_lapack95_ilp64.a
  </code></p>
  
  <p>it complain </p>
  
  <pre><code> /tmp/ccWtxMFP.o: In function `MAIN__':
   example.f95:(.text+0xf0): undefined reference to `dgesv_'
   collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>Can someone help me with this issue please ? Many thanks</p>