title: C inline functions and "undefined external" error
body: <p>I'm trying to replace some macro subroutines with inline functions, so the compiler can optimize them, so the debugger can step into them, etc.  If I define them as normal functions it works:</p>
  
  <pre><code>void do_something(void)
  {
    blah;
  }
  
  void main(void)
  {
    do_something();
  }
  </code></pre>
  
  <p>but if I define them as inline:</p>
  
  <pre><code>inline void do_something(void)
  {
    blah;
  }
  
  void main(void)
  {
    do_something();
  }
  </code></pre>
  
  <p>it says "Error: Undefined external".  What does that mean?  Taking a stab in the dark, I tried </p>
  
  <pre><code>static inline void do_something(void)
  {
    blah;
  }
  
  void main(void)
  {
    do_something();
  }
  </code></pre>
  
  <p>and no more errors.  The function definition and call to the function are in the same .c file.</p>
  
  <p>Can someone explain why one works and the other doesn't?  </p>
  
  <p>(Second related question: Where do I put inline functions if I want to use them in more than one .c file?)</p>