title: Does the order of -l and -L options in the GNU linker matter?
body: <p>The <code>-l</code> option tells the linker to search the libraries in the standard dirs.
  And with <code>-L</code>, we can specify our own library directories for searching.</p>
  
  <p>Question: Does the sequence of order matters for the <code>-L</code> option too, like it does for the <code>-l</code> w.r.t the linker?</p>
  
  <p>This link: <a href="http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html" rel="nofollow noreferrer">http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html</a> doesn't say much about the sequence of <code>-L</code>.</p>
  
  <p><strong>EDIT</strong>
  Also, </p>
  
  <blockquote>
    <p>Directories specified on the command
    line are searched before the default
    directories</p>
  </blockquote>
  
  <p>is from the man page (as pointed by Dmitry), does this mean that even if I specify the order like:</p>
  
  <pre><code>gcc -lm hello.c -Lx
  </code></pre>
  
  <p>still the directory specified with <code>-L</code> will be given preference first?</p>