 <p>That's definitely an error with <code>getdisc</code> not being visible to the linker but, if what you say is correct, that shouldn't happen.</p> <p>The <code>gcc</code> command line you have includes <code>graph1.c</code> which you assure use contains the function.</p> <p>Don't worry about the object file name, that's just a temprary name created by the compiler to pass to the linker.</p> <p>Can you confirm (exact cut and paste) the <code>gcc</code> command line you're using, and show us the function definition with some context around it?</p> <p>In addition, make sure that <code>graph1.c</code> is being compiled as expected by inserting immediately before the <code>getdisc</code> function, the following line:</p> <pre><code>xyzzy plugh twisty; </code></pre> <p>If your function is being seen by the compiler, that should cause an error <em>first.</em> It may be something like <code>ifdef</code> statements causing your code not to be compiled.</p> <p>By way of testing, the following transcript shows that what you are <em>trying</em> to do works just fine:</p> <pre><code>pax&gt; cat shells2.c #include "graph2.h" int main (void) { int x = getdisc (); return x; } pax&gt; cat graph2.h int getdisc (void); pax&gt; cat graph1.c int getdisc (void) { return 42; } pax&gt; gcc -o rr4 shells2.c graph1.c pax&gt; ./rr4 pax&gt; echo $? 42 </code></pre> <p>We have to therefore assume that what you're <em>actually</em> doing is something different, and that's unusually tactful for me :-)</p> <p>What you're experiencing is what would happen with something like:</p> <pre><code>pax&gt; gcc -o rr4 shells2.c /tmp/ccb4ZOpG.o: In function `main': shells2.c:(.text+0xa): undefined reference to `getdisc' collect2: ld returned 1 exit status </code></pre> <p>or if <code>getdisc</code> was <em>not</em> declared correctly in <code>graph1.c</code>.</p> <p>That last case could be for many reasons including, but not limited to:</p> <ul> <li>mis-spelling of <code>getdisc</code>.</li> <li><code>#ifdef</code> type statements meaning the definition is never seen (though you seem to have discounted that in a comment).</li> <li>some wag using <code>#define</code> to change <code>getdisc</code> to something else (unlikely, but possible).</li> </ul>