title: Error: (functionName) already defined in Algorithms.obj
body: <pre><code>1&gt;GameWinMain.obj : error LNK2005: "bool __cdecl BPredicate(class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; const &amp;)" (?BPredicate@@YA_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) already defined in Algorithms.obj
  1&gt;C:\Algorithms.exe : fatal error LNK1169: one or more multiply defined symbols found
  </code></pre>
  
  <p>I'm getting the latter when trying to declare a function in the header.
  I'm not sure what's causing this, everything has include guards.
  Funny thing is: if I define the function in the header as inline, it compiles.
  Can anyone help?</p>
  
  <p>See code Below:</p>
  
  <p><em><strong>Algorithms.h</em></strong></p>
  
  <pre><code>#pragma once
  
  //...other code
  
  bool BPredicate(const string&amp; a, const string&amp; b){
      string::const_iterator it;
      UINT numA = 0;
      UINT numB = 0;
      for (it = a.begin(); it != a.end(); ++it) {
          if((*it) == ' ') {
              if (*(it-1) != ' ') {
                  ++numA;
              }
          }
      }
      for (it = b.begin(); it != b.end(); ++it) {
          if((*it) == ' ') {
              if (*(it-1) != ' ') {
                  ++numB;
              }
          }
      }
  
      return (numA &lt; numB);
  }
  </code></pre>
  
  <p><em><strong>GameWinMain.h</em></strong></p>
  
  <pre><code>#pragma once
  
  #define WIN32_LEAN_AND_MEAN
  #include &lt;windows.h&gt;
  
  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow);
  </code></pre>
  
  <p><em><strong>GameWinMain.cpp</em></strong></p>
  
  <pre><code>#include "GameWinMain.h"
  #include "GameEngine.h"
  #include "Algorithms.h" 
  
  #define GAME_ENGINE (GameEngine::GetSingleton())
  
  int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
  {
      if (GAME_ENGINE == NULL) return FALSE; 
  
      GAME_ENGINE-&gt;SetGame(new Algorithms()); 
  
      return GAME_ENGINE-&gt;Run(hInstance, iCmdShow); 
  }
  </code></pre>