How to declare an enum type?

Discussion in 'C++' started by bashill.zhu@gmail.com, Sep 26, 2008.

  1. Guest

    bzhu@TY-PC /h/working/tcplex/ch8/testenum
    $ cat lexer.h
    namespace Lexer
    {
    enum Token_value;
    extern Token_value string_value;
    void get_token();
    }

    bzhu@TY-PC /h/working/tcplex/ch8/testenum
    $ cat lexer.cpp
    #include "lexer.h"
    namespace Lexer{
    enum Token_value{
    one,two
    };
    }
    void Lexer::get_token()
    {
    }



    bzhu@TY-PC /h/working/tcplex/ch8/testenum
    $ g++ -c lexer.cpp
    In file included from lexer.cpp:1:
    lexer.h:3: error: use of enum `Token_value' without previous
    declaration
    lexer.h:4: error: `Token_value' does not name a type

    Thanks !
     
    , Sep 26, 2008
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    5
    Views:
    726
  2. Eric Sosman
    Replies:
    3
    Views:
    864
    Mayeul
    Feb 26, 2010
  3. Wojtek
    Replies:
    1
    Views:
    572
  4. Lew
    Replies:
    0
    Views:
    604
  5. Roedy Green
    Replies:
    0
    Views:
    812
    Roedy Green
    Feb 27, 2010
Loading...

Share This Page