title: What is the difference between gcc test.c -L. -lft and gcc test.c libft.a?
body: <p>I have a static library with the filename &quot;libft.a&quot; and a .c file with the main called &quot;test.c&quot;.</p>
  <p>How do these two commands differ from each other?</p>
  <pre><code>gcc test.c -L. -lft
  gcc test.c libft.a
  </code></pre>
  <p>Both commands compile well, and the binary file produces the expected output.</p>
  <p>Is the first command more specific about linking static / dynamic libraries?
  Can the easier syntax cause unexpected behavior with libraries?</p>
  <p>I also have a libft.h file that is related; it's included in test.c with</p>
  <pre><code>#include &quot;./includes/libft.h&quot;
  </code></pre>
  <p>And the object files (that are put into the static library and indexed) are created with</p>
  <pre><code>gcc -c src1.c src2.c src3.c -Iincludes
  </code></pre>
  <p>The general file structure looks like this:</p>
  <pre><code>libft.a
  test.c
  includes/
  ├─ libft.h
  srcs/
  ├─ src1.c
  </code></pre>