title: Multiple errors when building c++ program
body: <p>In my program I am building a maze. Whenever I build my project I receive these errors. I know that these errors are referring to lines 1-3 on my header file. But I have put those lines in difference places across my program and I cannot get my project to build. In my header file I am defining a maze class and an coordinate class. I know that my program is not complete yet, but I need to fix these errors so that I can run and test my program.</p>
  
  <p>Header:</p>
  
  <pre><code>const int HEIGHT = 1003;
  const int WIDTH = 1003;
  char grid[WIDTH][HEIGHT];
  
  class Maze
  {
      public:
          Maze();
          ~Maze();
          void drawMaze();
          void addPaths();
          void startGame();
          void movePlayer(int);
          bool solved();
          int getKey();
          void addDestinationToGrid();
      private:
  
  };
  
  class Coordinate
  {
      public:
          int row, column;
  };
  
  Coordinate player;
  
  const static char PLAYER = 'P';
  const static char DESTINATION = 'X';
  const static char START = 'S';
  const static char PATH = ' ';
  const static char WALL = (char) 219;
  </code></pre>
  
  <p>Implementation:</p>
  
  <pre><code>#include "maze.h"
  #include "windows.h"
  #include &lt;stack&gt;
  using namespace std;
  
  
  Maze::Maze()
  {
  
  }
  
  Maze::~Maze()
  {
  
  }
  
  void Maze::drawMaze()
  {
      for (int x = 0; x &lt; HEIGHT; x++)
      {
          for (int y = 0; y &lt; WIDTH; y++)
          {
              grid[x][y] = WALL;
          }
      }
  }
  
  void Maze::startGame()
  {
      int input;
      do
      {
              input = getKey();
              movePlayer(input);
      } while (!solved());
  }
  
  bool Maze::solved()
  {
      return true;
  }
  
  void Maze::movePlayer(int)
  {
  
  }
  
  int Maze::getKey()
  {
      int result = 0;
      while (!solved() &amp;&amp; result == 0)
      {
          short MAX_SHORT = 0x7FFF; //111111111111111
          if (GetAsyncKeyState(VK_LEFT) &amp; MAX_SHORT)
          {
              result = VK_LEFT;
          }
          else if (GetAsyncKeyState(VK_UP) &amp; MAX_SHORT)
          {
              result = VK_UP;
          }
          else if (GetAsyncKeyState(VK_RIGHT) &amp; MAX_SHORT)
          {
              result = VK_RIGHT;
          }
          else if (GetAsyncKeyState(VK_DOWN) &amp; MAX_SHORT)
          {
              result = VK_DOWN;
          }
      }
      return result;
  }
  
  void Maze::addPaths()
  {
      Coordinate currentLocation;
      Coordinate startLocation;
      Coordinate endLocation;
      std::stack&lt;Coordinate&gt; stack;
  
      currentLocation.row = (((rand() % HEIGHT) / 2) * 2);
      currentLocation.column = (((rand() % WIDTH) / 2) * 2);
  
      startLocation = currentLocation;
      grid[currentLocation.row][currentLocation.column] = START;
      player = currentLocation;
      do 
      {
          drawMaze();
          bool canMoveUp = !(currentLocation.row == 0 || grid[currentLocation.row - 2][currentLocation.column] != WALL);
          bool canMoveDown = !(currentLocation.row == HEIGHT - 1 || grid[currentLocation.row + 2][currentLocation.column] != WALL);
          bool canMoveLeft = !(currentLocation.column == 0 || grid[currentLocation.row][currentLocation.column - 2] != WALL);
          bool canMoveRight = !(currentLocation.column == WIDTH - 1 || grid[currentLocation.row][currentLocation.column + 2] != WALL);
  
          if (canMoveUp || canMoveDown || canMoveLeft || canMoveRight)
          {
              stack.push(currentLocation);
  
              //choose random location to dig
              bool moveFound = false;
              while (!moveFound)
              {
                  int direction = rand() % 4;
                  if (direction == 0 &amp;&amp; canMoveUp)
                  {
                      moveFound = true;
                      grid[currentLocation.row - 2][currentLocation.column] = PATH;
                      grid[currentLocation.row - 1][currentLocation.column] = PATH;
                      currentLocation.row -= 2;
                  }
                  else if (direction == 1 &amp;&amp; canMoveDown)
                  {
                      moveFound = true;
                      grid[currentLocation.row + 2][currentLocation.column] = PATH;
                      grid[currentLocation.row + 1][currentLocation.column] = PATH;
                      currentLocation.row += 2;
                  }
                  else if (direction == 2 &amp;&amp; canMoveLeft)
                  {
                      moveFound = true;
                      grid[currentLocation.row][currentLocation.column - 2] = PATH;
                      grid[currentLocation.row][currentLocation.column - 1] = PATH;
                      currentLocation.column -= 2;
                  }
                  else if (direction == 3 &amp;&amp; canMoveRight)
                  {
                      moveFound = true;
                      grid[currentLocation.row][currentLocation.column + 2] = PATH;
                      grid[currentLocation.row][currentLocation.column - 2] = PATH;
                      currentLocation.column += 2;
                  }
              }
          }
          else if (!stack.empty())
          {
              currentLocation = stack.top();
              stack.pop();
          }
      } while (!stack.empty());
      addDestinationToGrid();
  }
  
  void Maze::addDestinationToGrid()
  {
  
  }
  </code></pre>
  
  <p>Errors:  </p>
  
  <pre><code>maze.obj : error LNK2005: "char (* grid)[1003]" (?grid@@3PAY0DOL@DA) already defined in Main.obj
  maze.obj : error LNK2005: "class Coordinate player" (?player@@3VCoordinate@@A) already defined in Main.obj
  C:\Users\Matthew\Desktop\Comp 345\MazeOOP\Debug\MazeOOP.exe : fatal error LNK1169: one or more multiply defined symbols found
  </code></pre>