title: c++ LNK2001: unresolved external symbol problem
body: <p>Greetings.</p>
  
  <p>I have searched for a solution, but I think this problem is personal code specific, hence my posting here.</p>
  
  <p>I'll get straight to the point.</p>
  
  <p>In my main I have two objects.</p>
  
  <pre><code>Computer *computer = new Computer();
  Player *player = new Player();
  </code></pre>
  
  <p>In the computer class, in the header I have the following:</p>
  
  <pre><code>  private:
  
  Strategy *strategy;
  int winningPosition;
  int twoInRow;
  int counter;
  int makeTwo;
  </code></pre>
  
  <p>Then in Computer.cpp:</p>
  
  <pre><code>Computer::Computer(char token, bool hasTurn)
  {
      m_token = token;
      m_hasTurn = hasTurn;
      strategy = new Strategy();
  }
  
  int Computer::getMove(const char (&amp;board)[9])
  {
      twoInRow = strategy-&gt;checkTwoInRow(board);
      counter = strategy-&gt;counter(board);
      makeTwo = strategy-&gt;makeTwo(board);
  
      if(twoInRow != 0)
      {
          return twoInRow - 1;
      } else if(counter != 0) {
          return counter - 1;
      } else if(makeTwo != 0) {
          return makeTwo - 1;
      } else {
          return 0;
      }
  }
  </code></pre>
  
  <p>At this point I think the problem arises.</p>
  
  <p>The methods called from the class Strategy all require knowledge of the board thus:</p>
  
  <pre><code>int checkTwoInRow(const char (&amp;board)[9]);
  int counter(const char (&amp;board)[9]);
  int makeTwo(const char (&amp;board)[9]);
  </code></pre>
  
  <p>The problems im getting, unabling them to compile:</p>
  
  <pre><code>Error   1   error LNK2019: unresolved external symbol "public: int __thiscall Strategy::makeTwo(char const (&amp;)[9])" (?makeTwo@Strategy@@QAEHAAY08$$CBD@Z) referenced in function "public: int __thiscall Computer::getMove(char const (&amp;)[9])" (?getMove@Computer@@QAEHAAY08$$CBD@Z)    C:\CPP\TTT\Computer.obj tictactoeCPP
  
  Error   2   error LNK2019: unresolved external symbol "public: int __thiscall Strategy::counter(char const (&amp;)[9])" (?counter@Strategy@@QAEHAAY08$$CBD@Z) referenced in function "public: int __thiscall Computer::getMove(char const (&amp;)[9])" (?getMove@Computer@@QAEHAAY08$$CBD@Z)    C:\CPP\TTT\Computer.obj tictactoeCPP
  
  Error   3   error LNK2019: unresolved external symbol "public: int __thiscall Strategy::checkTwoInRow(char const (&amp;)[9])" (?checkTwoInRow@Strategy@@QAEHAAY08$$CBD@Z) referenced in function "public: int __thiscall Computer::getMove(char const (&amp;)[9])" (?getMove@Computer@@QAEHAAY08$$CBD@Z)    C:\CPP\TTT\Computer.obj tictactoeCPP
  </code></pre>
  
  <p>As a c++ noob, I have absolutely no clue why or how this problem is caused. I think it has to do something with either the instantiation of Strategy in the computer class, or with the parameter given from computer to the strategy in the method calls.</p>
  
  <p>Can anyone explain WHY this error is occuring, I don't quite understand the error at all.
  And also how to solve/prevent this?</p>
  
  <p>EDIT*</p>
  
  <p>I just got a request to share the Strategy class:</p>
  
  <p>Strategy.h:</p>
  
  <pre><code>    #pragma once
  class Strategy
  {
  public:
      Strategy(void);
      ~Strategy(void);
  
      int checkTwoInRow(const char (&amp;board)[9]);
      int counter(const char (&amp;board)[9]);
      int makeTwo(const char (&amp;board)[9]);
  };
  </code></pre>
  
  <p>The class defined these methods, I won't post them because they are quite long.</p>