Thread: Odd enum error...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    66

    Odd enum error...

    Code:
    // CInc.h
    //
    
    #ifndef CINC_H_
    #define CINC_H_
    
    // Income levels
    enum inct
    {
    	BELOW_POVERTY,
    	POVERTY,
    	LOWER CLASS,		// if I don't comment this line out to the last element
    	MIDDLE CLASS,		// the program errors, error below in my post
    	UPPER CLASS,
    	RICH,
    	BILL_GATES
    };
    
    class CInc
    {
    private:
    	// Data about their income level, ya da ya da ya da
    	inct m_IncomeLevel;
    public:
    	// Accessors
    	inct getInc() { return m_IncomeLevel; }
    
    	// Mutators
    	void setInc(inct IncomeLevel) { m_IncomeLevel = IncomeLevel; }
    };
    
    #endif CINC_H_
    The error list is at the end of this post because it's rather long and I'm not sure which errors are relevant (I know it's usually the first ones or so, but in this case I'm not sure) Anyhow, it's confusing me. I have a 3 element enum in another header file that works fine, if I reduce this enum to 2 elements it's fine. I've checked the MSDN docs and it appears that this is the correct method of using an enum, so...any ideas?

    Errors:

    (12) : error C2146: syntax error : missing '}' before identifier 'CLASS'
    (13) : error C2146: syntax error : missing ';' before identifier 'CLASS'
    (13) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    (13) : error C2371: 'CLASS' : redefinition; different basic types
    (12) : see declaration of 'CLASS'
    (14) : error C2146: syntax error : missing ';' before identifier 'CLASS'
    (14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    (14) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    (14) : error C2371: 'CLASS' : redefinition; different basic types
    (12) : see declaration of 'CLASS'
    (15) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    (17) : error C2143: syntax error : missing ';' before '}'
    (17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    (17) : error C2143: syntax error : missing ';' before '}'
    (17) : error C2059: syntax error : '}'
    "When your work speaks for itself - don't interrupt!"

    -Samantha Ingraham.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    You forgot the underscore (presumably) between LOWER and CLASS (etc).
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    66
    Ah...I'm stupid ^_^. I looked the list over and over and didn't catch that...hah...night time is wonderful.. XD
    "When your work speaks for itself - don't interrupt!"

    -Samantha Ingraham.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  2. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM