title: Old Fortran Program: ld returned 1 exit status
body: <p>I have an old FORTRAN 77 program that I am having trouble compiling / building as normal with:
   <code>gfortran -Wall -o "filename" filename.f</code></p>
  
  <p>It keeps giving me the linker error:</p>
  
  <pre><code>$ gfortran -Wall  ljewald.f 
  
  /usr/lib/gcc/i686-linux-gnu/4.7/../../../i386-linux-gnu/crt1.o: In function `_start':
  (.text+0x18): undefined reference to `main'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>Eventually, I tried: <code>gfortran -Wall -c -o "filename" filename.f</code> which gives me compiled binary file. Ok great, but the man page for gfortran is sketching me out. here is the material for the -c option that makes this all seem to work:</p>
  
  <pre><code>   -C  Do not discard comments. All comments are passed through to the output file, except for comments in processed directives, which are deleted
         along with the directive.
  
         You should be prepared for side effects when using -C; it causes the preprocessor to treat comments as tokens in their own right. For example,
         comments appearing at the start of what would be a directive line have the effect of turning that line into an ordinary source line, since the
         first token on the line is no longer a '#'.
  
         Warning: this currently handles C-Style comments only. The preprocessor does not yet recognize Fortran-style comments.
  </code></pre>
  
  <p>So, after building this, using:
  <code>gfortran -Wall -c -o "ljewald"  ljewald.f</code></p>
  
  <p>I get an output file, but its isn’t an executable...?</p>
  
  <pre><code>$ls -l
  ...
  -rw-rw-r--  1 j0h j0h    647 Aug  9 16:36 ljewald 
  ...
  </code></pre>
  
  <p>I cant execute this file, even if i change the mode with chmod +x ljewald</p>
  
  <p>what can I do to avoid the -c option, since using it has quirks?
  And how can I build an executable of this program?
  Can someone explain, and tell me how to fix this:?</p>
  
  <pre><code>/usr/lib/gcc/i686-linux-gnu/4.7/../../../i386-linux-gnu/crt1.o: In function `_start':
  (.text+0x18): undefined reference to `main'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>link to source:
  <a href="http://nanocluster.umeche.maine.edu/ljewald.f" rel="nofollow">http://nanocluster.umeche.maine.edu/ljewald.f</a></p>