title: (C++) error: expected primary-expression before ';' token
body: <p>My compiler's complaining and throwing up an error (see the title) about this code:</p>
  
  <pre><code>int toLevel(int xp)
  {
      int points = 0;
      int level = 1;
      for(; level &lt; MAX_LEVEL; level++)
      {
          points += floor(level + 300*pow(2, level/7.));
          if(xp &lt; points)
          {
              break;
          }
      }
      return level;
  }
  </code></pre>
  
  <p>The error is on the <code>for(; level &lt; MAX_LEVEL; level++)</code> line, and the full error log looks like (that's line 50, for reference):</p>
  
  <pre><code>In function 'int toLevel(int)':
  50    error: expected primary-expression before ';' token
  50    error: expected ')' before ';' token
  50    error: expected ';' before ')' token
  48    warning: unused variable 'points'
  59    error: expected '}' at end of input
  59    warning: no return statement in function returning non-void
  === Build finished: 4 errors, 2 warnings ===
  </code></pre>
  
  <p>Any ideas? I'm assuming I haven't closed a bracket somewhere, but I just can't find it.
  As I suspect this may be the case, here's the full code for that file:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;sstream&gt;
  #include &lt;vector&gt;
  #include &lt;math.h&gt;
  
  using namespace std;
  
  #define MAX_LEVEL 99;
  
  #include "main.h"
  
  int main()
  {
      Player player;
      loadSkills(player);
      if(!loadGame(player))
      {
          cout &lt;&lt; "It looks like its your first time playing." &lt;&lt; endl;
          cout &lt;&lt; "What's your name?: ";
          cin &gt;&gt; player.name;
      }
      cout &lt;&lt; "Hello " &lt;&lt; player.name &lt;&lt; ", you're level " &lt;&lt; toLevel(player.xp) &lt;&lt; endl;
      //TODO
      return 0;
  }
  
  //Returns true if loaded, false otherwise
  bool loadGame(Player player)
  {
      //TODO
      return false;
  }
  
  void loadSkills(Player player)
  {
      vector&lt;Skill&gt; skills;
      skills.push_back((Skill){"Melee"});
      skills.push_back((Skill){"Woodcutting"});
      skills.push_back((Skill){"Firemaking"});
      skills.push_back((Skill){"Fishing"});
      skills.push_back((Skill){"Cooking"});
      player.skills = skills;
  }
  
  int toLevel(int xp)
  {
      int points = 0;
      int level = 1;
      for(; level &lt; MAX_LEVEL; level++)
      {
          points += floor(level + 300*pow(2, level/7.));
          if(xp &lt; points)
          {
              break;
          }
      }
      return level;
  }
  </code></pre>
  
  <p>and the main.h it references:</p>
  
  <pre><code>#ifndef MAIN_H_INCLUDED
  #define MAIN_H_INCLUDED
  
  vector&lt;string&gt; &amp;split(const string &amp;s, char delim, vector&lt;string&gt; &amp;elems) {
      stringstream ss(s);
      string item;
      while(getline(ss, item, delim)) {
          elems.push_back(item);
      }
      return elems;
  }
  
  //Ease of use method
  vector&lt;string&gt; split(const string &amp;s, char delim) {
      vector&lt;string&gt; elems;
      return split(s, delim, elems);
  }
  
  struct Skill
  {
      string name;    //The name of the skill
  };
  
  struct Player
  {
      int health;             //The player's current health
      int xp;                 //The player's xp
      int maxhealth;          //The player's max health
      vector&lt;Skill&gt; skills;   //The skills available to the player
      string name;            //The player's name
  };
  
  class InteractOption
  {
      public:
      void doAction();//What should happen
      bool succeeded; //If true, they get the xp for it.
      int xp;         //Amount of xp gained for doing
      Skill skill;    //Skill to gain xp in
      string name;    //"Chop"/"Attack"/etc
  };
  
  class WorldObject
  {
      public:
      InteractOption interactOption;  //The option for interacting with the object.
                                      //Can be null (i.e. can't interact)
      string name;                    //"Tree"/"Goblin"/etc
  };
  
  bool loadGame(Player);
  void loadSkills(Player);
  int toLevel(int);
  
  #endif // MAIN_H_INCLUDED
  </code></pre>