Thread: VERY basic classes not working

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937

    VERY basic classes not working

    I'm trying to create my own type of variable, and my compiler won't have it. I can fix the errors it gives me, but by doing so I would have to change what I'm actually DOING. What's wrong?

    --------------------Configuration: Windows - Win32 Debug--------------------
    Compiling...
    Windows.cpp

    c:\program files\microsoft visual studio\vc98\include\david.h(14) : warning C4091: 'typedef ' : ignored on left of 'class _ERROR' when no variable is declared

    c:\program files\microsoft visual studio\vc98\include\david.h(14) : error C2143: syntax error : missing ';' before 'constant'

    c:\program files\microsoft visual studio\vc98\include\david.h(14) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.

    Windows.exe - 2 error(s), 1 warning(s)

    PHP Code:
    typedef  class _ERROR
    {
        
    bool NewError();
        
    char *Message;
        
    bool MessageSwitch;
        
    bool SwitchOff();
        
    bool SwitchOn();

    }
    ERROR
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #2
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    Nevermind. "ERROR" is pre-defined. My bad. I'll change it to "ERR".
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    Code:
    class _ERROR
    {
        // add constructor, destructor and other functions here.
    };
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    ...and in C++ you don't need that typedef anymore. Just name your class ERROR ( or something else if it's already used ).
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 01-13-2008, 02:14 AM
  2. Working with winAPI in classes (newbie question)
    By Spyril in forum Windows Programming
    Replies: 3
    Last Post: 11-09-2007, 03:21 PM
  3. Exporting VC++ classes for use with VB
    By Helix in forum Windows Programming
    Replies: 2
    Last Post: 12-29-2003, 05:38 PM
  4. Questions on Classes
    By Weng in forum C++ Programming
    Replies: 2
    Last Post: 11-18-2003, 06:49 AM
  5. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 07:26 PM