title: C++ undefined reference error to function even though the function already exists
body: <p>I am getting below error,</p>
  
  <p><strong>Focus//build/libfocus.a(FocusParser.o): In function <code>FocusParser::parse(std::string const&amp;)':
  /builddir/project/src/Focus/FocusParser.cpp:22: undefined reference to</code>yyFC_scan_bytes(char const*, int)'</strong></p>
  
  <p>The code is as follow. As seen in the code the function is already defined on line 12. Please help.</p>
  
  <pre><code>  1 #include &lt;stdio.h&gt;
    2 #include &lt;errno.h&gt;
    3 #include &lt;string.h&gt;
    4
    5 #include "Exception.h"
    6 #include "Builder.h"
    7
    8 #include "FocusParser.h"
    9 #include "FocusState.h"
   10
   11 int yyFCparse();
   12 int yyFC_scan_bytes(const char *bytes, int len);
   13
   14 FocusStatePtr FocusParser::parse(const string &amp;query)
   15 {
   16   // mutex lock for focus
   17   boost::mutex::scoped_lock lock(gFocusStateMutex);
   18
   19   // setup parse context
   20   gFocusState = FocusStatePtr(new FocusState());
   21
   22   yyFC_scan_bytes(query.data(), query.length());
   23
   24   yyFCparse();
   25
   26   // reset global state info
   27   FocusStatePtr result = gFocusState;
   28   gFocusState.reset();
   29
   30   return result;
   31 }
  </code></pre>