title: GCC: link error while linking files from parent directory
body: <p>I am getting a link error while including C files from a parent directory. I appreciate any help or hint.</p>
  <p><code>hashcons_test.c</code> imports</p>
  <pre><code>#include &quot;hashcons.h&quot;   // I have tried &quot;../hashcons.h&quot; but no success 
  
  #include &quot;stdbool.h&quot;
  #include &quot;stdio.h&quot;
  #include &quot;stdlib.h&quot;
  </code></pre>
  <p>Makefile</p>
  <pre><code>CC=gcc 
  CFLAGS=-I ..
  
  all: output test clean
  output: driver.o
      $(CC) $(CFLAGS) hashcons_test.o driver.o -o output
  
  prime.o: ../prime.h ../prime.c
      $(CC) -c $(CFLAGS) ../prime.c -o ../prime.o
  
  hashcons.o: prime.o ../hashcons.h ../hashcons.c
      $(CC) -c $(CFLAGS) ../hashcons.h -o ../hashcons.o
  
  hashcons_test.o: hashcons.o hashcons_test.c
      $(CC) -c $(CFLAGS) hashcons_test.c
  
  driver.o: hashcons_test.o
      $(CC) -c $(CFLAGS) driver.c -o driver.o
  
  test: output
      @./output
  
  clean:
      @rm -rf *.o output
  </code></pre>
  <p>Directory</p>
  <pre><code>.
  ├── hashcons.c
  ├── hashcons.h
  ├── prime.c
  ├── prime.h
  └── tests
      ├── Makefile
      ├── driver.c
      ├── driver.o
      ├── hashcons_test.c
      └── hashcons_test.o
  </code></pre>
  <p>Error:</p>
  <pre><code>gcc  -c -I .. ../prime.c -o ../prime.o
  gcc  -c -I .. ../hashcons.h -o ../hashcons.o
  gcc  -c -I .. hashcons_test.c
  gcc  -c -I .. driver.c -o driver.o
  gcc  -I .. hashcons_test.o driver.o -o output
  Undefined symbols for architecture x86_64:
    &quot;_hash_cons_get&quot;, referenced from:
        _new_hash_cons_integer in hashcons_test.o
        _new_hash_cons_integer in driver.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make: *** [output] Error 1
  </code></pre>
  <p><code>hash_cons_get</code> is a function defined in <code>hascons.h</code></p>