title: sharing a function between 2 .c files
body: <p>dir1 has dir2, file1.c and file1.h.</p>
  
  <p>dir2 has file2.c</p>
  
  <p>Now, if I want to access a function defined in file1.c in file2.c, I need to declare it in file1.h and include file1.h in file2.c -- is that a valid assumption?</p>
  
  <p>If no, please explain.</p>
  
  <p>If yes, even after doing that I am getting "undefined reference to function" error.</p>
  
  <blockquote>
    <p>file2.c:29: undefined reference to `function'
    collect2: ld returned 1 exit status
    <em>*</em> Error code 1</p>
  </blockquote>