title: Is a function definition not allowed here before a '{' token?
body: <p>I am creating a game, and I have this code. However, it is not working:</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  const int MAX_ITEMS = 100;
  bool running = 1;
  int playerInfo[2];
  void titleFunc();
  int userInput = 0;
  
  void newGameFunc();
  
  int main() {
      titleFunc();
      newGameFunc();
      int playerLocation = 0;
      while (running) {
  
      }
  
      if (playerLocation == 1) {
          cout &lt;&lt; "You are in a dungeon. You have just woke up from escaping the execution of your father. You see a pathway to the North, and a large gaping hole to the South.\n";
          cout &lt;&lt; "1. Go South\n 2. Go North";
          cin &gt;&gt; userInput;
          if (userInput == 1) 
              playerLocation = 2;
          else 
              if (userInput == 2) 
                  playerLocation = 3;
      }
      return 0;
  
      titleFunc() {
          cout &lt;&lt; "\t\t\t\t---Fantasee---\n\n\n";
          cout &lt;&lt; "\t\t\t\t     1:Play\n";
  
          cin &gt;&gt; userInput;
  
          if (userInput == 1) {
              newGameFunc();
          }
          else {
              running = 0;
          }
          return;
      }
  
      newGameFunc() {
          cout &lt;&lt; "Welcome to Fantasee, a world of adventure and danger. \n";
          cout &lt;&lt; "To begin, please enter your gender: \n 1. Male 2. Female";
          cin &gt;&gt; userInput;
          playerInfo[0] = userInput;
  
          cout &lt;&lt; "And what class do you wish to be? \n 1. Wizard 2. Archer 3. Warrior 4. Trickster 5. Knight 6. Assassin";
          cin &gt;&gt; userInput;
          playerInfo[1] = userInput;
          playerLocation = 1;
          return;
      }
  }
  
  }
  }
  </code></pre>
  
  <p>And I am getting the error message:</p>
  
  <blockquote>
    <p>g++ Main.cpp -o Main <br/>
    Main.cpp: In function ‘int main()’: <br/>
    Main.cpp:36:17: error: expected ‘;’ before ‘{’ token <br/>
    Main.cpp:67:1: error: expected ‘}’ at end of input <br/>
     <br/>
    Edit: Wrong Error Message <br/>
    Edited code to current. <br/></p>
  </blockquote>