title: c++ struct does not name a type error
body: <p>I get the following errors when trying to compile this code, why?</p>
  
  <p>"game.h:48:42: error: ‘player’ does not name a type</p>
  
  <p>game.h:48:50: error: ISO C++ forbids declaration of ‘enemies’ with no type [-fpermissive] "</p>
  
  <p>Line 48 is the function "fillMap" btw</p>
  
  <pre><code>//game.h
  
  #ifndef GAME_H
  #define GAME_H
  
  //CONSTANTS AND TEMPLATES
  
  const int LEN = 40;
  
  struct player
  {
     char name[LEN]; //name of character
     char symbol; //character representing player on map
     int posx; // x position on map
     int posy; // y position on map
     bool alive; // Is the player alive
     double damage; // Player attacking power
     double health; // Player health
  };
  
  enum direction {LEFT, RIGHT, UP, DOWN};
  
  //PROTOTYPES
  
  //move amount specified in position structure
  void moveAmount(player&amp; pl, int posx, int posy);
  
  //move to specified position on map
  void moveTo(player&amp; pl, int posx, int posy);
  
  //one player attacking other
  //returns whether attack was successfull
  bool attack(const player &amp; atacker, player &amp; target);
  
  //one player attacking a direction on the map, epl is a pointer to an array of enemies           players
  //returns whether attack was sucessfull
  bool attack(const player &amp; pl, direction, player* epl);
  
  //Check if player is dead, to be called inside attack function
  inline bool isDead(const player&amp; pl){
      return pl.health &lt;= 0 ? 1 : 0;
  }
  
  //Remove player from map if he is dead
  void kill(player&amp; pl);
  
  //Initialize map
  void fillMap(const player&amp; player, const player* enemies, int mapWidth, int mapHeigth);
  
  //Display map
  void displayMap(const int mapWidth, const int mapHeigth);
  
  #endif
  </code></pre>