title: Fortran 90 compiling issue: undefined reference to <modulename>
body: <p>I'm having trouble trying to compile a simple fortran program which uses a module in the same directory.
  I have 2 files: test1.f90 which contains the program and modtest.f90 which contains the module.</p>
  
  <p>This is test1.f90:</p>
  
  <pre><code>program test
    use modtest
    implicit none
    print*,a
  end program test
  </code></pre>
  
  <p>This is modtest.f90:</p>
  
  <pre><code>module modtest
    implicit none
    save
    integer :: a = 1
  end module modtest
  </code></pre>
  
  <p>Both files are in the same directory. I compile modtest.f90 and test.f90 like this:</p>
  
  <pre><code>gfortran -c modtest.f90
  gfortran -o test1 test1.f90
  </code></pre>
  
  <p>But then I get this error:</p>
  
  <pre><code>/tmp/cckqu8c3.o: In function `MAIN__':
  test1.f90:(.text+0x50): undefined reference to `__modtest_MOD_a'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>Is there something I'm missing?
  Thanks for the help</p>