title: Apple Mach-O Linker (Id) Error 1 - Basic C++ with header files
body: <p>I am trying to create a Xcode project for the first time (I'm using C and C++, no Obj-C).</p>
  
  <p>This is the structure of the project:</p>
  
  <blockquote>
    <p>project</p>
    
    <blockquote>
      <p>main.cpp  </p>
    </blockquote>
    
    <p>headers</p>
    
    <blockquote>
      <p>a.h<br>
      b.h  </p>
    </blockquote>
    
    <p>sources</p>
    
    <blockquote>
      <p>a.c<br>
      b.c</p>
    </blockquote>
  </blockquote>
  
  <p><strong>Sample content:</strong></p>
  
  <p>a.h:</p>
  
  <pre><code>void some_fun();
  </code></pre>
  
  <p>b.h:</p>
  
  <pre><code>#include "a.h"
  </code></pre>
  
  <p>main.cpp:</p>
  
  <pre><code>#include "b.h"
  int main(){
      some_fun();
  }
  </code></pre>
  
  <p>In compile sources, main.cpp, a.c and b.c are included.<br>
  When I try to build this, I get one error for each invocation of <code>some_fun()</code> and then one more error.  </p>
  
  <p><strong>The errors are:</strong>  </p>
  
  <blockquote>
    <p>Apple Mach-O Linker (Id) Error<br>
    --"some_fun()" referenced from :<br>
    --_main in main.o</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>Apple Mach-O Linker (Id) Error 
    --Linker command failed with exit code 1</p>
  </blockquote>
  
  <p>Is there anything I have missed in XCode configuration?<br>
  Is there a problem in using <code>a.h</code>'s function in <code>main.cpp</code> without explicitly including it?<br>
  Or is my structure fundamentally wrong due to some reason (I was able to build this via command line though) ? </p>