[OCLUG-devel] Where to put enum

Christopher Smith x at xman.org
Sat Jun 5 11:15:32 PDT 2004


On Fri, 2004-06-04 at 20:36, Stephen Crane wrote:
> Hi all,
> 
> I have a slight difficulty. I am putting my class declarations in classes.h 
> (is this correct?) I have an enum that I use in one of my classes:
> Position GetAdjCell (dir direction) const;  //where dir is an enum
> 
> Now when I #include the classes.h file gcc throws a fit since it doesn't know 
> what enum means (#include is processed by the preprocessor). Would it be 
> correct for me to put the enum at the top of my classes.h? What should go in 
> my .h file?

It sounds to me like your problem isn't where the enum is, but rather
some kind of syntactical error in the enum line.

FYI, if the enum is tied to the class, I encourage declaring it inside
the class itself.

--Chris


More information about the OCLUG-devel mailing list