title: 'Scanner' does not name a type error in g++
body: <p>I'm trying to compile code in g++ and I get the following errors:</p>
  
  <p>In file included from scanner.hpp:8,<br>
                   from scanner.cpp:5:<br>
  parser.hpp:14: error: ‘Scanner’ does not name a type<br>
  parser.hpp:15: error: ‘Token’ does not name a type</p>
  
  <p>Here's my g++ command:</p>
  
  <p>g++ parser.cpp scanner.cpp -Wall</p>
  
  <p>Here's parser.hpp:</p>
  
  <pre><code>#ifndef PARSER_HPP
  #define PARSER_HPP
  #include &lt;string&gt;
  #include &lt;map&gt;
  #include "scanner.hpp"
  using std::string;
  
  
  class Parser
  {
  // Member Variables
      private:
          Scanner lex;  // Lexical analyzer 
          Token look;   // tracks the current lookahead token
  
  // Member Functions
      &lt;some function declarations&gt;
  };
  
  #endif
  </code></pre>
  
  <p>and here's scanner.hpp:</p>
  
  <pre><code>#ifndef SCANNER_HPP
  #define SCANNER_HPP
  
  #include &lt;iostream&gt;
  #include &lt;cctype&gt;
  #include &lt;string&gt;
  #include &lt;map&gt;
  #include "parser.hpp"
  using std::string;
  using std::map;
  
  enum
  {
  // reserved words
      BOOL, ELSE, IF, TRUE, WHILE, DO, FALSE, INT, VOID,
  // punctuation and operators
      LPAREN, RPAREN, LBRACK, RBRACK, LBRACE, RBRACE, SEMI, COMMA, PLUS, MINUS, TIMES,
      DIV, MOD, AND, OR, NOT, IS, ADDR, EQ, NE, LT, GT, LE, GE,
  // symbolic constants
      NUM, ID, ENDFILE, ERROR 
  };
  
  
  class Token
  {
      public:
          int tag;
          int value;
          string lexeme;
          Token() {tag = 0;}
          Token(int t) {tag = t;}
  };
  
  class Num : public Token
  {
      public:
          Num(int v) {tag = NUM; value = v;}
  };
  
  class Word : public Token
  {
      public:
      Word() {tag = 0; lexeme = "default";}
          Word(int t, string l) {tag = t; lexeme = l;}
  };
  
  
  class Scanner
  {
      private:
          int line;               // which line the compiler is currently on
          int depth;              // how deep in the parse tree the compiler is
          map&lt;string,Word&gt; words; // list of reserved words and used identifiers
  
  // Member Functions
      public:
          Scanner();
          Token scan();
          string printTag(int);
          friend class Parser;
  };
  
  #endif
  </code></pre>
  
  <p>anyone see the problem?  I feel like I'm missing something incredibly obvious.</p>