title: Having trouble with the gcc -I flag
body: <p>I'm sure this is something embarrassingly simple but I can't get gcc or clang to use a custom include directory.
  I'm using Linux Mint. The project lives in a directory called <code>morg</code>.</p>
  <p>This is the mind blowing code I have at <code>morg/src/main.c</code></p>
  <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt;
  #include &quot;GLFW/glfw3.h&quot;
  
  int main(){
      printf(&quot;hello world!\n&quot;);
      return 0;
  }
  </code></pre>
  <p>The directory <code>morg/include</code> contains <code>GLFW/glfw3.h</code>
  The directory <code>morg/lib</code> contains <code>libglfw3.a</code>, the compiled library I'm trying to use.</p>
  <p>I have a bash file at <code>morg/build.sh</code></p>
  <pre class="lang-sh prettyprint-override"><code>#!/bin/bash
  gcc -Wall -Wextra -v -g -o -Iinclude -Llib -lglfw3 morg src/main.c
  </code></pre>
  <p>I used <a href="https://www.rapidtables.com/code/linux/gcc/gcc-i.html" rel="nofollow noreferrer">this</a> website to help me put it together.
  The compiler is able to see the static library I am trying to link to but running the above results in the following:</p>
  <pre><code>Using built-in specs.
  COLLECT_GCC=gcc
  COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
  OFFLOAD_TARGET_NAMES=nvptx-none
  OFFLOAD_TARGET_DEFAULT=1
  Target: x86_64-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.4.0-1ubuntu1~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
  Thread model: posix
  gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1) 
  COLLECT_GCC_OPTIONS='-Wall' '-Wextra' '-v' '-g' '-o' '-Iinclude' '-Llib' '-mtune=generic' '-march=x86-64'
   /usr/lib/gcc/x86_64-linux-gnu/7/cc1 -quiet -v -imultiarch x86_64-linux-gnu src/main.c -quiet -dumpbase main.c -mtune=generic -march=x86-64 -auxbase main -g -Wall -Wextra -version -fstack-protector-strong -Wformat-security -o /tmp/cc7OGbRB.s
  GNU C11 (Ubuntu 7.4.0-1ubuntu1~18.04.1) version 7.4.0 (x86_64-linux-gnu)
      compiled by GNU C version 7.4.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP
  
  GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
  ignoring nonexistent directory &quot;/usr/local/include/x86_64-linux-gnu&quot;
  ignoring nonexistent directory &quot;/usr/lib/gcc/x86_64-linux-gnu/7/../../../../x86_64-linux-gnu/include&quot;
  #include &quot;...&quot; search starts here:
  #include &lt;...&gt; search starts here:
   /usr/lib/gcc/x86_64-linux-gnu/7/include
   /usr/local/include
   /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
   /usr/include/x86_64-linux-gnu
   /usr/include
  End of search list.
  GNU C11 (Ubuntu 7.4.0-1ubuntu1~18.04.1) version 7.4.0 (x86_64-linux-gnu)
      compiled by GNU C version 7.4.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP
  
  GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
  Compiler executable checksum: fa57db1fe2d756b22d454aa8428fd3bd
  src/main.c:2:10: fatal error: GLFW/glfw3.h: No such file or directory
   #include &quot;GLFW/glfw3.h&quot;
            ^~~~~~~~~~~~~~
  compilation terminated.
  </code></pre>
  <p>I can see <code>include &quot;...&quot; starts here</code> is empty and <code>include &lt;...&gt; starts here</code> is unchanged whether or not I include <code>-Iinclude</code> in the command line options.</p>
  <p>I am also a tiny bit concerned about the lines that say <code>ignoring nonexistent directory</code> but it doesn't look like it's related.</p>
  <p>I thought clang might provide more a more helpful error message but it's basically identical.</p>
  <p>For what it's worth I've used GLFW before but on Windows with Visual Studio.</p>
  <p>What am I missing? I have scoured the internet high and low in my search and am feeling pretty dumb.</p>
  <p><strong>Edit:</strong>
  As the top comment says I had the <code>-o</code> command in the wrong place but that wasn't the only problem! I needed to put <code>-lglfw</code> (not <code>-lglfw3</code>) after the main source file like so:</p>
  <p><code>gcc -Wall -Wextra -g -Iinclude -Llib -o morg src/main.c -lglfw</code></p>