title: g++ linker can't find const member function
body: <p>I have a Point class (with integer members x and y) that has a member function <code>withinBounds</code> that is declared like so:</p>
  
  <p><code>bool withinBounds(const Point&amp;, const Point&amp;) const;</code></p>
  
  <p>and defined like this:</p>
  
  <pre><code>bool Point::withinBounds(const Point&amp; TL, const Point&amp; BR) const
  {
      if(x &lt; TL.getX()) return false;
      if(x &gt; BR.getX()) return false;
      if(y &lt; TL.getY()) return false;
      if(y &gt; BR.getY()) return false;
  
      // Success
      return true;
  }
  </code></pre>
  
  <p>and then in another file, I call <code>withinBounds</code> like this:</p>
  
  <pre><code>Point pos = currentPlayer-&gt;getPosition();
  if(pos.withinBounds(topleft, bottomright))
  {
      // code block
  }
  </code></pre>
  
  <p>This compiles fine, but it fails to link.  g++ gives me this error:</p>
  
  <p><code>/home/max/Desktop/Development/YARL/yarl/src/GameData.cpp:61: undefined reference to 'yarl::utility::Point::withinBounds(yarl::utility::Point const&amp;, yarl::utility::Point const&amp;)'</code></p>
  
  <p>When I make the function not const, it links fine.  Anyone know the reason why?  The linker error looks like it's looking for a non-const version of the function, but I don't know why it would.</p>