title: Visual C++ Linker Error 2019
body: <p>I'm trying to include a simple hash table class in some files with a header class. But whenever I try to compile I get several errors like this:</p>
  
  <p>LNK2019: unresolved external symbol " public: __thiscall HashTable::~HashTable(void)" (??1HashTable@@QAE@XZ) referenced in function _main "</p>
  
  <p>I'm using Visual Studio 2010. I am aware that this means it can't find the function definition in any of the source files. But I have defined them, in a file in the same directory as the file it's called in. Perhaps Visual Studio doesn't look in the current directory unless you set some linker option?</p>
  
  <p>Here is the source code: </p>
  
  <pre><code>//HashTable.h
  #ifndef HASH_H
  #define HASH_H
  
  class HashTable {
  
  public:
      HashTable();
      ~HashTable();
      void AddPair(char* address, int value);
      //Self explanatory
      int GetValue(char* address);
      //Also self-explanatory. If the value doesn't exist it throws "No such address"
  
  };
  
  #endif
  
  
  
  //HashTable.cpp
  class HashTable {
  protected:
      int HighValue;
      char** AddressTable;
      int* Table;
  
  public:
      HashTable(){
          HighValue = 0;
      }
      ~HashTable(){
          delete AddressTable;
          delete Table;
      }
      void AddPair(char* address, int value){
          AddressTable[HighValue] = address;
          Table[HighValue] = value;
          HighValue += 1;
      }
      int GetValue(char* address){
          for (int i = 0; i&lt;HighValue; i++){
              if (AddressTable[HighValue] == address) {
  
                  return Table[HighValue];
              }
          }
          //If the value doesn't exist throw an exception to the calling program
          throw 1;
      };
  
  };
  </code></pre>