title: Compiling program using gfortran and the HDF-EOS2 library
body: <p>I have the problem of linking the HDF-EOS library to a Fortran90 program. I have compiled the library from source to a directory specified in $prefix. My simple compile command is:</p>
  
  <pre><code>gfortran -I$prefix/include -L$prefix/lib -Wl,-rpath -Wl,$prefix/lib -lhdfeos -lGctp -lmfhdf -ldf -lz -lsz -ljpeg tst.f90
  </code></pre>
  
  <p>When compiling, I get the following error:</p>
  
  <pre><code>undefined reference to `gdopen_'
  </code></pre>
  
  <p>In the program, which I am not supposed to change, the HDF-EOS library is used via the external keyword, e.g.</p>
  
  <pre><code>integer(kind=4), external :: gdopen
  </code></pre>
  
  <p>In the library, <strong>nm $prefix/lib/libhdfeos.a | grep gdopen</strong> gives me:</p>
  
  <pre><code>00000000000120c0 T gdopen
  </code></pre>
  
  <p>When compiling with <strong>-fno-underscoring</strong>, I get just a different error:</p>
  
  <pre><code>gfortran -fno-underscoring -I$prefix/include -L$prefix/lib -Wl,-rpath -Wl,$prefix/lib -lhdfeos -lGctp -lmfhdf -ldf -lz -lsz -ljpeg tst.f90
  </code></pre>
  
  <p>the error is then:</p>
  
  <pre><code>undefined reference to `gdopen'
  </code></pre>
  
  <p>Also, gfortran finds the libraries, otherwise it would complain. Is the error related to the underscore? What else can I try? I work on Fedora and gfortran version 4.7.2.</p>